Skip to content

Commit

Permalink
Merge pull request #174 from ESSS/fb-ASIM-5273-drop-py36-qmx
Browse files Browse the repository at this point in the history
Drop python 3.6
  • Loading branch information
prusse-martin authored Nov 10, 2023
2 parents c479b0c + fa9d413 commit 697cb91
Show file tree
Hide file tree
Showing 14 changed files with 158 additions and 181 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,28 @@ jobs:
strategy:
fail-fast: false
matrix:
CONDA_PY: ["36", "37", "38", "39"]
PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
# We need to install Qt on the system otherwise tests in
# tests/test_qt_js_integration.py crash.
- name: Install Qt
uses: jurplel/install-qt-action@v2
- uses: browser-actions/[email protected]
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
auto-activate-base: true
activate-environment: ''
activate-environment: ""
channels: conda-forge,esss
channel-priority: true
- name: Install
env:
CONDA_PY: ${{ matrix.CONDA_PY }}
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
run: |
conda config --system --set always_yes yes --set changeps1 no
conda install -c conda-forge conda-devenv
conda info -a
export TEST_QMXGRAPH=1
conda devenv -n qmxgraph
conda install -n qmxgraph coveralls pytest-cov
conda init bash
conda list -n qmxgraph
- name: Tests
shell: bash -l {0}
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ target/
# PyCharm files
.idea/

# Underling mxgraph library that could have been cloned.
/mxgraph/

# Generate Qt resource files
resource_*.qrc
resource_*.py
Expand Down
6 changes: 5 additions & 1 deletion _base_environment.devenv.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% set TEST_QMXGRAPH = os.environ.get('TEST_QMXGRAPH', '0') != '0' %}
name: qmxgraph

dependencies:
- python >=3.6
- python >=3.7

- attrs >=17
- colorama
Expand All @@ -16,5 +17,8 @@ dependencies:
environment:
PYTHONPATH:
- {{ root }}/src
{% if TEST_QMXGRAPH %}
- {{ root }}/tests
{% endif %}
MYPYPATH:
- {{ root }}/src
17 changes: 11 additions & 6 deletions environment.devenv.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% set TEST_QMXGRAPH = os.environ.get('TEST_QMXGRAPH', '0') != '0' %}
{% set PYTHON_VERSION = os.environ.get('PYTHON_VERSION', '3.6') %}
{% set PYTHON_VERSION = os.environ.get('TRAVIS_PYTHON_VERSION', PYTHON_VERSION) %}
{% set PYTHON_VERSION = os.environ.get('PYTHON_VERSION', '3.10') %}

name: qmxgraph

Expand All @@ -10,22 +9,28 @@ includes:
environment:
# Tip: Use `--driver <driver_name>` to change driver for a single run
{% if TEST_QMXGRAPH %}
PYTEST_ADDOPTS: --driver PhantomJS
PYTEST_ADDOPTS: --driver Chrome
{% endif %}

dependencies:
- python ={{ PYTHON_VERSION }}

- more-itertools <10.0.0 # [PYTHON_VERSION == '3.7']

{% if TEST_QMXGRAPH %}
- cherrypy
- hypothesis ==3.11.0
- cherrypy >=18.0.0
- pytest-mock
- pytest-qt
- pytest-rerunfailures
- pytest-selenium >=1,<2
- pytest-selenium >2
- pytest-timeout
# Recent selenium versions (>=4.10.0) are currently incompatible with pytest-selenium (some constructor changed argument list).
- selenium >=4.0.0, <4.10.0
{% if sys.platform != 'win32' %}
- pytest-xvfb
{% endif %}

# Not really required to run the tests but are closely related.
- coveralls
- pytest-cov
{% endif %}
31 changes: 6 additions & 25 deletions esss_environment.devenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,15 @@ includes:
- {{ root }}/_base_environment.devenv.yml

environment:
# PhantomJS
# pros:
# * doesn't open a browser (i.e. known as headless)
# * as consequence, doesn't interfere with developer GUI
# * uses Webkit, same web browser engine used by Qt
#
# cons:
# * seems slower than Firefox driver
# * harder to debug (can't put a breakpoint and take a look at web driver's
# browser, for instance)
#
# Firefox
# pros:
# * easier to debug (Firefox [and Chrome] already come with developer tools
# builtin nowadays)
#
# cons:
# * pops up a Firefox instance for each test
# * it is not the same web browser engine as used by Qt
#
# Tip: Use `--driver <driver_name>` to change driver for a single run
{% if TEST_QMXGRAPH %}
PYTEST_ADDOPTS: --driver PhantomJS
PYTEST_ADDOPTS: --driver Chrome
{% else %}
PYTEST_ADDOPTS: ""
{% endif %}

dependencies:
- python>=3.5
- python>=3.7
- mxgraph>=3.7.5

- esss-pylupdate5>=5.6.0+1
Expand All @@ -49,13 +29,14 @@ dependencies:
{% if TEST_QMXGRAPH %}
- conda-wrappers

- cherrypy==7.1.0
- phantomjs>=2.1
- cherrypy>=18.0.0
- pytest-mock>=1.4.0
- pytest-qt>=2.1.0
- pytest-selenium>=1.2.1,<2
- pytest-selenium>2
- pytest-timeout>=1.0.0
- pytest-xdist>=1.15
# Recent selenium versions (>=4.10.0) are currently incompatible with pytest-selenium (some constructor changed argument list).
- selenium >=4.0.0, <4.10.0
{% if sys.platform != 'win32' %}
- pytest-xvfb
{% endif %}
Expand Down
8 changes: 7 additions & 1 deletion scripts/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
git clone --depth=1 --branch v3.7.5 https://github.com/jgraph/mxgraph.git
export PYTEST_ADDOPTS="--driver PhantomJS"
export MXGRAPHPATH=mxgraph

export LIBGL_ALWAYS_SOFTWARE=1
export GALLIUM_DRIVER=llvmpipe
export ENABLE_LLVMPIPE_GL=1
export QT_QUICK_BACKEND=software
export QTWEBENGINE_CHROMIUM_FLAGS="--disable-gpu --no-sandbox"

inv qrc
inv test
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Software Development :: User Interfaces',
],
Expand Down
12 changes: 1 addition & 11 deletions src/qmxgraph/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import textwrap
import weakref
from contextlib import contextmanager
from contextlib import nullcontext
from typing import Any
from typing import Generator
from typing import List
Expand Down Expand Up @@ -1020,13 +1020,3 @@ def handle_message(msg_type, context, message):
yield messages
finally:
qInstallMessageHandler(previous_handler)


if sys.version_info[:] < (3, 7):

@contextmanager
def nullcontext(enter_result=None):
yield enter_result

else:
from contextlib import nullcontext
24 changes: 21 additions & 3 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,29 @@ def create_web_resource(resource_name, src_dir):
print_message('{}* generated {}'.format(indent * 2, py_file))

mxgraph = os.environ.get('MXGRAPHPATH', None)
if mxgraph is None:
if mxgraph is not None:
if not os.path.isdir(mxgraph):
raise IOError(
"Unable to determine MxGraph to use:"
" directory obtained from `MXGRAPHPATH` env var does not exist"
)

else:
env_dir = deploy.get_conda_env_path()
if env_dir is None:
raise IOError("Unable to determine MxGraph mxgraph in " "environment")
raise IOError(
"Unable to determine MxGraph to use:"
" no `MXGRAPHPATH` env var defined"
" and no conda environment active"
)

mxgraph = '{env_dir}/mxgraph'.format(env_dir=env_dir)
if not os.path.isdir(mxgraph):
raise IOError(
"Unable to determine MxGraph to use:"
" no `MXGRAPHPATH` env var defined"
" and not located in active conda environment"
)

create_web_resource(
resource_name='mxgraph', src_dir='{folder}/javascript/src'.format(folder=mxgraph)
Expand Down Expand Up @@ -137,7 +155,7 @@ def docs(ctx, python_version=None):
@invoke.task
def test(ctx):
print_message('test'.format(), color=Fore.BLUE, bright=True)
cmd = 'pytest --cov=qmxgraph --timeout=30 -v --durations=10'
cmd = 'pytest --cov=qmxgraph --timeout=30 -v --durations=10 --color=yes'

import subprocess

Expand Down
Empty file removed tests/__init__.py
Empty file.
Loading

0 comments on commit 697cb91

Please sign in to comment.