From 47655e449265eefc5ef7da4958d75433ab3500b4 Mon Sep 17 00:00:00 2001 From: Cyrille Rossant Date: Tue, 4 Jun 2019 18:28:49 +0200 Subject: [PATCH] Windows fixes --- environment.yml | 1 - installer/environment.yml | 1 - phy/apps/template/tests/test_gui.py | 2 +- phy/cluster/supervisor.py | 2 +- phy/cluster/views/tests/test_base.py | 4 +++- phy/gui/tests/test_state.py | 4 +++- phy/plot/panzoom.py | 5 +++-- phy/utils/tests/test_profiling.py | 4 ++-- requirements.txt | 1 - tools/api.py | 4 +--- tools/release.py | 4 +--- 11 files changed, 15 insertions(+), 17 deletions(-) diff --git a/environment.yml b/environment.yml index f8e407239..59821a453 100644 --- a/environment.yml +++ b/environment.yml @@ -14,6 +14,5 @@ dependencies: - requests - traitlets - tqdm - - six - joblib - click diff --git a/installer/environment.yml b/installer/environment.yml index bf6113c3a..aebb9c181 100644 --- a/installer/environment.yml +++ b/installer/environment.yml @@ -13,7 +13,6 @@ dependencies: - vispy - requests - traitlets - - six - joblib - click - tqdm diff --git a/phy/apps/template/tests/test_gui.py b/phy/apps/template/tests/test_gui.py index c0fe65707..3616f5e18 100644 --- a/phy/apps/template/tests/test_gui.py +++ b/phy/apps/template/tests/test_gui.py @@ -263,7 +263,7 @@ def test_template_gui_split_amplitude(qtbot, tempdir, template_controller): av = gui.list_views(AmplitudeView)[0] - a, b = 50, 1000 + a, b = 10, 1000 mouse_click(qtbot, av.canvas, (a, a), modifiers=('Control',)) mouse_click(qtbot, av.canvas, (a, b), modifiers=('Control',)) mouse_click(qtbot, av.canvas, (b, b), modifiers=('Control',)) diff --git a/phy/cluster/supervisor.py b/phy/cluster/supervisor.py index 7a7a40608..b637d4e2d 100644 --- a/phy/cluster/supervisor.py +++ b/phy/cluster/supervisor.py @@ -866,7 +866,7 @@ def split(self, spike_ids=None, spike_clusters_rel=0): if spike_ids is None: # Concatenate all spike_ids returned by views who respond to request_split. spike_ids = emit('request_split', self) - spike_ids = np.concatenate(spike_ids) + spike_ids = np.concatenate(spike_ids).astype(np.int64) assert spike_ids.dtype == np.int64 assert spike_ids.ndim == 1 if len(spike_ids) == 0: diff --git a/phy/cluster/views/tests/test_base.py b/phy/cluster/views/tests/test_base.py index 86bf51d91..762019f54 100644 --- a/phy/cluster/views/tests/test_base.py +++ b/phy/cluster/views/tests/test_base.py @@ -32,9 +32,11 @@ def test_manual_clustering_view_1(qtbot, tempdir): v.set_state({'auto_update': False}) assert v.auto_update is False - qtbot.wait(1) + qtbot.wait(10) path = v.screenshot(dir=tempdir) + qtbot.wait(10) + assert str(path).startswith(str(tempdir)) assert path.exists() diff --git a/phy/gui/tests/test_state.py b/phy/gui/tests/test_state.py index ad07f0f13..eb77ed949 100644 --- a/phy/gui/tests/test_state.py +++ b/phy/gui/tests/test_state.py @@ -7,6 +7,7 @@ #------------------------------------------------------------------------------ import logging +import os import shutil from ..state import GUIState, _gui_state_path, _get_default_state_path, _filter_nested_dict @@ -24,7 +25,8 @@ class MyClass(object): def test_get_default_state_path(): - assert str(_get_default_state_path(MyClass())).endswith('gui/tests/static/state.json') + assert str(_get_default_state_path(MyClass())).endswith( + os.sep.join(('gui', 'tests', 'static', 'state.json'))) def test_gui_state_view_1(tempdir): diff --git a/phy/plot/panzoom.py b/phy/plot/panzoom.py index 4e9f3dd26..31f166c22 100644 --- a/phy/plot/panzoom.py +++ b/phy/plot/panzoom.py @@ -515,8 +515,9 @@ def imap(self, arr): return arr def update_visual(self, visual): - visual.program[self.pan_var_name] = self._pan - visual.program[self.zoom_var_name] = self._zoom_aspect() + if hasattr(visual, 'program'): + visual.program[self.pan_var_name] = self._pan + visual.program[self.zoom_var_name] = self._zoom_aspect() def update(self): """Update all visuals in the attached canvas.""" diff --git a/phy/utils/tests/test_profiling.py b/phy/utils/tests/test_profiling.py index a0eba2eec..191e3b64f 100644 --- a/phy/utils/tests/test_profiling.py +++ b/phy/utils/tests/test_profiling.py @@ -23,8 +23,8 @@ def test_benchmark(): @mark.parametrize('line_by_line', [False, True]) -def test_profile(chdir_tempdir, line_by_line): +def test_profile(tempdir, line_by_line): # Remove the profile from the builtins. prof = _enable_profiler(line_by_line=line_by_line) _profile(prof, 'import time; time.sleep(.001)', {}, {}) - assert (chdir_tempdir / '.profile/stats.txt').exists() + assert (tempdir / '.profile/stats.txt').exists() diff --git a/requirements.txt b/requirements.txt index 4d288ca60..900b61f61 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ requests traitlets qtconsole tqdm -six joblib click mkdocs==1.0.4 diff --git a/tools/api.py b/tools/api.py index 0ba7ebe16..8fb6840e8 100644 --- a/tools/api.py +++ b/tools/api.py @@ -12,8 +12,6 @@ import re import sys -from six import string_types - #------------------------------------------------------------------------------ # Utility functions @@ -112,7 +110,7 @@ def _import_module(module_name): #------------------------------------------------------------------------------ def _is_public(obj): - name = _name(obj) if not isinstance(obj, string_types) else obj + name = _name(obj) if not isinstance(obj, str) else obj if name: return not name.startswith('_') else: diff --git a/tools/release.py b/tools/release.py index 4c33a8b9d..5e1e308f5 100644 --- a/tools/release.py +++ b/tools/release.py @@ -14,8 +14,6 @@ import re from subprocess import call -import six -from six.moves import input from github3 import login @@ -59,7 +57,7 @@ def _update_version(dev_n='+1', dev=True): def func(m): if dev: - if isinstance(dev_n, six.string_types): + if isinstance(dev_n, str): n = int(m.group(3)) + int(dev_n) assert n >= 0 else: