diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index 0d2b739..55fe335 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -10,7 +10,7 @@ # To get a newer version, you will need to update the SHA. # You can also reference a tag or branch, but the action may change without warning. -name: Docker build and push +name: Docker build on: workflow_dispatch: diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index d84a9e2..40e78a6 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -1,6 +1,15 @@ -name: Python tests +name: Tests -on: [push] +on: + workflow_dispatch: + push: + branches: + - 'main' + tags: + - 'v*.*.*' + pull_request: + branches: + - 'main' jobs: main-tests: @@ -36,3 +45,37 @@ jobs: run: | tox run -e pep8 tox run -e py -- tests + + windows-main-tests: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Install tox (and any other packages) + run: pip install tox + - name: Run tox + run: | + tox run -e pep8 + tox run -e py -- tests + tox run -e py -- integration-tests + + windows-compatibility-tests: + runs-on: windows-latest + strategy: + matrix: + python: ["3.9", "3.10", "3.11"] + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: Install tox (and any other packages) + run: pip install tox + - name: Run tox + run: | + tox run -e pep8 + tox run -e py -- tests diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index a4e1322..e096d9d 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -19,7 +19,7 @@ Contributing code 3. Write a test for your new feature/bugfix and run it, ensuring that it fails on the current implementation:: - py.test tests/test_my_code.py + pytest tests/test_my_code.py NameErrors, ImportErrors, SyntaxErrors, etc. do not count (they indicate the API is wrong). @@ -29,9 +29,7 @@ Contributing code tox run - Optionally, run integration tests (you must have Redis_ server - version 2.8 or later in your path; do ``redis-server --version`` - to check):: + Optionally, run integration tests:: tox run -- integration-tests @@ -41,10 +39,10 @@ Contributing code ``n-issue-abbrev`` where ``n`` is the issue number and ``issue-abbrev`` is a very short abbreviation of the issue title) and ensure that the build passes. The build is defined in - ``.gitlab-ci.yml`` (``.travis.yml`` and ``appveyor.yml`` for public + ``.gitlab-ci.yml`` (``.github/workflows`` for public builds); tox is configured in ``tox.ini``. The build includes unit tests, integration tests, and style checks and runs on - Python 3.5 across multiple platforms; if it fails, please + Python 3.8 across multiple platforms; if it fails, please find the error in the build log, fix it, and try again. 9. Add a line to ``CHANGELOG`` under the current version-in-progress describing your changes simply and concisely. Add yourself to ``AUTHORS`` diff --git a/README.rst b/README.rst index 102ff9c..1293060 100644 --- a/README.rst +++ b/README.rst @@ -5,8 +5,8 @@ Tutorial :target: https://badge.fury.io/py/concrete .. image:: https://github.com/hltcoe/concrete-python/actions/workflows/tox.yml/badge.svg :target: https://github.com/hltcoe/concrete-python/actions/workflows/tox.yml -.. image:: https://ci.appveyor.com/api/projects/status/0346c3lu11vj8xqj?svg=true - :target: https://ci.appveyor.com/project/cjmay/concrete-python-f3iqf +.. image:: https://github.com/hltcoe/concrete-python/actions/workflows/docker-build-and-push.yml/badge.svg + :target: https://github.com/hltcoe/concrete-python/actions/workflows/docker-build-and-push.yml Concrete-python is the Python interface to Concrete_, a diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index d987d6f..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,15 +0,0 @@ -clone_depth: 1 -version: '{build}-{branch}' -skip_branch_with_pr: false - -install: -- set PATH=C:\Python38-x64\scripts;C:\Python38-x64;%PATH% -- pip install 'tox>=4' -- git config core.symlinks true -- git reset --hard - -build_script: -# configured in tox.ini -- tox run -e pep8,docs -- tox run -e cov -- tests -- tox run -e py -- integration-tests diff --git a/integration-tests/test_create_comm.py b/integration-tests/test_create_comm.py index 6c879fa..24c1eae 100644 --- a/integration-tests/test_create_comm.py +++ b/integration-tests/test_create_comm.py @@ -5,22 +5,23 @@ from pytest import fixture, mark from concrete.util import CommunicationReader from concrete.validate import validate_communication +import os import sys from subprocess import Popen, PIPE @fixture def text(): - return u'''\ + return '''\ Madame Magloire comprit, et elle alla chercher sur la cheminée de la \ chambre à coucher de monseigneur les deux chandeliers d'argent \ -qu'elle posa sur la table tout allumés. - +qu'elle posa sur la table tout allumés.\ +''' + os.linesep + os.linesep + '''\ —Monsieur le curé, dit l'homme, vous êtes bon. Vous ne me méprisez \ pas. Vous me recevez chez vous. Vous allumez vos cierges pour moi. \ Je ne vous ai pourtant pas caché d'où je viens et que je suis un homme \ -malheureux. -''' +malheureux.\ +''' + os.linesep @fixture diff --git a/integration-tests/test_file_io.py b/integration-tests/test_file_io.py index 248cf71..b427f0f 100644 --- a/integration-tests/test_file_io.py +++ b/integration-tests/test_file_io.py @@ -193,33 +193,36 @@ def test_CommunicationReader_nested_zip_file(): def test_CommunicationReader_dir_without_recursive(): + root_path = os.path.join('tests', 'testdata', 'a', 'c') with raises(ValueError): - CommunicationReader("tests/testdata/a/c") + CommunicationReader(root_path) def test_CommunicationReader_dir(): - reader = CommunicationReader("tests/testdata/a/c", recursive=True) + root_path = os.path.join('tests', 'testdata', 'a', 'c') + reader = CommunicationReader(root_path, recursive=True) [filenames, comms] = zip(*sorted((f, c) for (c, f) in reader)) assert hasattr(comms[0], 'sentenceForUUID') assert hasattr(comms[1], 'sentenceForUUID') - assert u'two' == comms[0].id - assert u'three' == comms[1].id - assert u'tests/testdata/a/c/simple_2.concrete' == filenames[0] - assert u'tests/testdata/a/c/simple_3.concrete' == filenames[1] + assert 'two' == comms[0].id + assert 'three' == comms[1].id + assert os.path.join(root_path, 'simple_2.concrete') == filenames[0] + assert os.path.join(root_path, 'simple_3.concrete') == filenames[1] def test_CommunicationReader_nested_dir(): - reader = CommunicationReader("tests/testdata/a", recursive=True) + root_path = os.path.join('tests', 'testdata', 'a') + reader = CommunicationReader(root_path, recursive=True) [filenames, comms] = zip(*sorted((f, c) for (c, f) in reader)) assert hasattr(comms[0], 'sentenceForUUID') assert hasattr(comms[1], 'sentenceForUUID') assert hasattr(comms[2], 'sentenceForUUID') - assert u'one' == comms[0].id - assert u'two' == comms[1].id - assert u'three' == comms[2].id - assert u'tests/testdata/a/b/simple_1.concrete' == filenames[0] - assert u'tests/testdata/a/c/simple_2.concrete' == filenames[1] - assert u'tests/testdata/a/c/simple_3.concrete' == filenames[2] + assert 'one' == comms[0].id + assert 'two' == comms[1].id + assert 'three' == comms[2].id + assert os.path.join(root_path, 'b', 'simple_1.concrete') == filenames[0] + assert os.path.join(root_path, 'c', 'simple_2.concrete') == filenames[1] + assert os.path.join(root_path, 'c', 'simple_3.concrete') == filenames[2] def test_CommunicationReader_explicit_single_file():