Repository: spyder-ide/spyder

Issue:
pyqt5 Dependency seems outdated
## Problem Description
When installing, spyder downgrades pyqt5

### What steps reproduce the problem?

1. Have a new version of pyqt (eg. 5.11.x)
2. Install spyder
3. pyqt5 gets downgraded to pyqt5 < 5.10

### Issue
I dont see any need for that version downgrade. I always upgrade right after spyder install to the newest PyPi version wihtout any problems. Is there a reason to stay below 5.10? Is it possible to remove that from setup.py?


Discussion:
Maybe it would be a good option to leave it the user to choose between PyQt5 5.9 or 5.11 or PySide2 (5.11.0, 5.11.1, 5.11.2, 5.12.0, ...).

Spyder doesn't work with pyside2. Spyder team is waiting pyside2 to be less buggy 
> Spyder team is waiting pyside2 to be less buggy

This was true before, but now I have to say that a) we don't have time to support PySide2 and b) we gain nothing by doing so (sorry).

@stonebig and @mvillion, if you're willing to invest the (most probably) dozens of hours required to make our test suite pass on PySide2 and then you commit to keep maintaining it in the future, then we'll be glad to merge any PR sent our way.

Else, we have much more important things to focus on.
I am sorry I fired an off topic discussion regarding PySide2.  (I suppose PyQt is an import base for Spyder. Having a second option like PySide2 will make it future proof.)

The initial question raises a concern regarding Spyder being stuck to PyQt 5.9. Using Spyder forces the user to remain on 5.9 for PyQt5, PyQtChart and PyDataVisualization.
> The initial question raises a concern regarding Spyder being stuck to PyQt 5.9. Using Spyder forces the user to remain on 5.9 for PyQt5, PyQtChart and PyDataVisualization.

This is a valid point. We'll try to update that requirement to 5.12 during the holidays.
Is there a reason for the dependency being < anyway? Is it to be expected that PyQt introduces changes that break Spyder? Same for the python-language-server. This is 0.21 now on my system or so and spyder wants 0.19. Is it possible to have that >=0.19?
> Is it to be expected that PyQt introduces changes that break Spyder?

There were several strange errors and segfaults with 5.10

> Is it possible to have that >=0.19?

No, it's not because completion fails on Windows.

Resolving patch:
diff --git a/runtests.py b/runtests.py
--- a/runtests.py
+++ b/runtests.py
@@ -33,6 +33,9 @@ def main(run_slow=False, extra_args=None):
     if RUN_CI:
         pytest_args += ['-x', '--run-slow', '--cov=spyder',
                         '--cov=spyder_profiler', '--no-cov-on-fail']
+        # To display nice tests resume in Azure's web page
+        if os.environ.get('AZURE', None) is not None:
+            pytest_args += ['--cache-clear', '--junitxml=result.xml']
     elif run_slow:
         pytest_args += ['--run-slow']
     elif extra_args:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -244,12 +244,12 @@ def run(self):
     'keyring;sys_platform!="linux2"',
     # Packages for pyqt5 are only available in
     # Python 3
-    'pyqt5<5.10;python_version>="3"'
+    'pyqt5<=5.12;python_version>="3"'
 ]
 
 extras_require = {
     'test:python_version == "2.7"': ['mock'],
-    'test': ['pytest',
+    'test': ['pytest<4.1',
              'pytest-qt',
              'pytest-mock',
              'pytest-cov',


Test patch:
diff --git a/continuous_integration/posix/modules_test.sh b/continuous_integration/circle/modules_test.sh
similarity index 96%
rename from continuous_integration/posix/modules_test.sh
rename to continuous_integration/circle/modules_test.sh
--- a/continuous_integration/posix/modules_test.sh
+++ b/continuous_integration/circle/modules_test.sh
@@ -2,6 +2,9 @@
 
 set -ex
 
+source $HOME/miniconda/etc/profile.d/conda.sh
+conda activate test
+
 export TEST_CI_WIDGETS=True
 export PYTHONPATH=.
 
diff --git a/requirements/test_requirements.txt b/requirements/tests.txt
similarity index 88%
rename from requirements/test_requirements.txt
rename to requirements/tests.txt
--- a/requirements/test_requirements.txt
+++ b/requirements/tests.txt
@@ -1,6 +1,5 @@
 mock
-pytest
-pytest-qt
+pytest <4.1
 pytest-mock
 pytest-cov
 pandas
@@ -9,4 +8,5 @@ sympy
 pillow
 matplotlib
 cython
+pytest-qt
 flaky
diff --git a/spyder/plugins/tests/test_help.py b/spyder/plugins/tests/test_help.py
--- a/spyder/plugins/tests/test_help.py
+++ b/spyder/plugins/tests/test_help.py
@@ -17,6 +17,7 @@
     from mock import Mock, MagicMock  # Python 2
 
 # Third party imports
+from qtpy import PYQT_VERSION
 from qtpy.QtWidgets import QWidget
 from qtpy.QtWebEngineWidgets import WEBENGINE
 import pytest
@@ -75,6 +76,7 @@ def callback(data):
 # Tests
 # =============================================================================
 @flaky(max_runs=3)
+@pytest.mark.skipif(PYQT_VERSION > '5.10', reason='Segfaults in PyQt 5.10+')
 def test_no_docs_message(help_plugin, qtbot):
     """
     Test that no docs message is shown when instrospection plugins
@@ -87,6 +89,7 @@ def test_no_docs_message(help_plugin, qtbot):
 
 
 @flaky(max_runs=3)
+@pytest.mark.skipif(PYQT_VERSION > '5.10', reason='Segfaults in PyQt 5.10+')
 def test_no_further_docs_message(help_plugin, qtbot):
     """
     Test that no further docs message is shown when instrospection
@@ -102,6 +105,7 @@ def test_no_further_docs_message(help_plugin, qtbot):
                     timeout=3000)
 
 
+@pytest.mark.skipif(PYQT_VERSION > '5.10', reason='Segfaults in PyQt 5.10+')
 def test_help_opens_when_show_tutorial_unit(help_plugin, qtbot):
     """Test fix for #6317 : 'Show tutorial' opens the help plugin if closed."""
     MockDockwidget = MagicMock()
diff --git a/spyder/plugins/tests/test_init.py b/spyder/plugins/tests/test_init.py
--- a/spyder/plugins/tests/test_init.py
+++ b/spyder/plugins/tests/test_init.py
@@ -16,6 +16,7 @@
 
 # 3rd party imports
 import pytest
+from qtpy import PYQT_VERSION
 from qtpy.QtCore import QEvent
 
 # Local imports
@@ -25,6 +26,7 @@
 # =============================================================================
 # Tests
 # =============================================================================
+@pytest.mark.skipif(PYQT_VERSION > '5.10', reason='Segfaults in PyQt 5.10+')
 def test_tabfilter_typeerror_simple():
     """Test for #5813 ; event filter handles None indicies when moving tabs."""
     MockEvent = MagicMock()
diff --git a/spyder/utils/tests/test_programs.py b/spyder/utils/tests/test_programs.py
--- a/spyder/utils/tests/test_programs.py
+++ b/spyder/utils/tests/test_programs.py
@@ -25,7 +25,11 @@
     VALID_W_INTERPRETER = os.path.join(python_dir, 'pythonw.exe')
     INVALID_INTERPRETER = os.path.join(python_dir, 'Scripts', 'ipython.exe')
 else:
-    home_dir = os.environ['HOME']
+    if sys.platform.startswith('linux'):
+        home_dir = os.environ['HOME']
+    else:
+        # Parent Miniconda dir in macOS Azure VMs
+        home_dir = os.path.join('/usr', 'local')
     VALID_INTERPRETER = os.path.join(home_dir, 'miniconda', 'bin', 'python')
     VALID_W_INTERPRETER = os.path.join(home_dir, 'miniconda', 'bin', 'pythonw')
     INVALID_INTERPRETER = os.path.join(home_dir, 'miniconda', 'bin', 'ipython')