diff options
author | Dominik Holland <dominik.holland@qt.io> | 2021-07-05 16:30:32 +0200 |
---|---|---|
committer | Dominik Holland <dominik.holland@googlemail.com> | 2022-01-27 13:50:04 +0100 |
commit | 73da49d5914dad7a5334a48f937d02b52000cff6 (patch) | |
tree | 8f0d2353405b22dd1c697f47074aaa9e39c877ec | |
parent | 0ad45a6f0a5d113ed04f71a1499d8f7741475ce0 (diff) | |
download | qtivi-qface-73da49d5914dad7a5334a48f937d02b52000cff6.tar.gz |
Fix deprecated API usage
In addition fix all warnings found by flake.
Also enable flake8 checks and more verbose test output on the CI.
-rw-r--r-- | .github/workflows/python-package.yml | 4 | ||||
-rw-r--r-- | .github/workflows/release.yml | 4 | ||||
-rw-r--r-- | .github/workflows/weekly.yml | 2 | ||||
-rwxr-xr-x | cli.py | 12 | ||||
-rw-r--r-- | qface/generator.py | 2 | ||||
-rw-r--r-- | qface/idl/listener.py | 4 | ||||
-rw-r--r-- | tests/test_parser.py | 10 |
7 files changed, 19 insertions, 19 deletions
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index fe74806..9075bab 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -37,12 +37,12 @@ jobs: - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names - #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide #flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - python -m pytest + python -m pytest -v -s -l upload: needs: [ build ] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 79cfb76..806640c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,12 +38,12 @@ jobs: - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names - #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide #flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - python -m pytest + python -m pytest -v -s -l upload: needs: [ build ] diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index 5dbe5ed..9d4f76c 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -37,4 +37,4 @@ jobs: fi - name: Test with pytest run: | - python -m pytest + python -m pytest -v -s -l @@ -15,7 +15,7 @@ import logging.config here = Path(__file__).abspath().dirname() -logging.config.dictConfig(yaml.load((here / 'log.yaml').open())) +logging.config.dictConfig(yaml.load((here / 'log.yaml').open(), Loader=yaml.FullLoader)) logger = logging.getLogger(__name__) @@ -84,11 +84,11 @@ def pack(): sh('unzip -l dist/*.whl') -@cli.command() -def docs_serve(): - server = Server() - server.watch('docs/*.rst', shell('make html', cwd='docs')) - server.serve(root='docs/_build/html', open_url=True) +#@cli.command() +#def docs_serve(): +# server = Server() +# server.watch('docs/*.rst', shell('make html', cwd='docs')) +# server.serve(root='docs/_build/html', open_url=True) @cli.command() diff --git a/qface/generator.py b/qface/generator.py index 47cfd82..3974cbc 100644 --- a/qface/generator.py +++ b/qface/generator.py @@ -143,7 +143,7 @@ class Generator(object): def get_template(self, name): """Retrieves a single template file from the template loader""" source = name - if name and name[0] is '/': + if name and name[0] == '/': source = name[1:] elif self.source is not None: source = '/'.join((self.source, name)) diff --git a/qface/idl/listener.py b/qface/idl/listener.py index 2d8bfb6..4ed7af4 100644 --- a/qface/idl/listener.py +++ b/qface/idl/listener.py @@ -24,7 +24,7 @@ contextMap = {} def escape_decode(s): - """removes \-escapes from str""" + """removes \\-escapes from str""" return codecs.decode(bytes(s, 'utf-8'), 'unicode_escape') class QFaceListener(TListener): @@ -99,7 +99,7 @@ class DomainListener(QFaceListener): type.nested = TypeSymbol("", type) self.parse_type(ctxSymbol, type.nested) if not type.module.checkType(type): - log.warn('Unknown type: {0}. Missing import?'.format(type.name)) + log.warning('Unknown type: {0}. Missing import?'.format(type.name)) def parse_annotations(self, ctx, symbol): assert ctx and symbol diff --git a/tests/test_parser.py b/tests/test_parser.py index 62b661c..324b68a 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -111,8 +111,8 @@ def test_enum_counter(): enum = system.lookup('com.pelagicore.test.State') assert type(enum) is domain.Enum assert enum - assert enum._memberMap['Null'].value is 0 - assert enum._memberMap['Failure'].value is 3 + assert enum._memberMap['Null'].value == 0 + assert enum._memberMap['Failure'].value == 3 def test_flag_counter(): @@ -120,9 +120,9 @@ def test_flag_counter(): flag = system.lookup('com.pelagicore.test.Phase') assert type(flag) is domain.Enum assert flag - assert flag._memberMap['PhaseOne'].value is 1 - assert flag._memberMap['PhaseTwo'].value is 2 - assert flag._memberMap['PhaseThree'].value is 4 + assert flag._memberMap['PhaseOne'].value == 1 + assert flag._memberMap['PhaseTwo'].value == 2 + assert flag._memberMap['PhaseThree'].value == 4 def test_flag(): |