Skip to content

Commit

Permalink
Test using pytest; update README, package files, and GitHub Actions w…
Browse files Browse the repository at this point in the history
…orkflow.
  • Loading branch information
lapets committed Mar 15, 2022
1 parent a832327 commit 2207f74
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/lint-test-build-upload.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: lint-test-build-upload
on:
push
env:
RELEASE: "2.1.0"
jobs:
manylinux:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -35,10 +37,10 @@ jobs:
auditwheel repair tmpwheelhouse/bcl*.whl -w wheelhouse/
- name: Lint and test module (and compiled libsodium shared library file).
run: |
.venv/bin/pip install -U pylint coverage coveralls nose
.venv/bin/pip install -U pylint pytest pytest-cov coveralls
.venv/bin/python -m pylint bcl # Check against linting rules.
.venv/bin/python bcl/bcl.py -v # Run doctests.
.venv/bin/python -m nose --cover-erase # Test using nose.
.venv/bin/python -m pytest # Run tests.
.venv/bin/python -m coveralls --service=github # Submit to coveralls.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -48,7 +50,7 @@ jobs:
mv wheelhouse/bcl*.whl bcl-wheelhouse/
- uses: actions/upload-artifact@v1
with:
name: "bcl-2.0.0-manylinux1-${{ matrix.PYTHON }}"
name: "bcl-${{ env.RELEASE }}-manylinux1-${{ matrix.PYTHON }}"
path: bcl-wheelhouse/
macos:
runs-on: macos-latest
Expand Down Expand Up @@ -93,17 +95,17 @@ jobs:
run: venv/bin/pip install -f wheelhouse --no-index bcl
- name: Lint and test module (and compiled libsodium shared library file).
run: |
venv/bin/pip install -U pip pylint coverage nose
venv/bin/pip install -U pip pytest pytest-cov
venv/bin/python -m pylint bcl # Check against linting rules.
venv/bin/python bcl/bcl.py -v # Run doctests.
venv/bin/python -m nose --cover-erase # Test using nose.
venv/bin/python -m pytest # Run tests.
- name: Upload wheel file.
run: |
mkdir bcl-wheelhouse
mv wheelhouse/bcl*.whl bcl-wheelhouse/
- uses: actions/upload-artifact@v1
with:
name: "bcl-2.0.0-macOS-${{ matrix.PYTHON.VERSION }}"
name: "bcl-${{ env.RELEASE }}-macOS-${{ matrix.PYTHON.VERSION }}"
path: bcl-wheelhouse/
macos-arm:
runs-on: macOS-11
Expand Down Expand Up @@ -148,17 +150,17 @@ jobs:
run: venv/bin/pip install -f wheelhouse --no-index bcl
- name: Lint and test module (and compiled libsodium shared library file).
run: |
venv/bin/pip install -U pip pylint coverage nose
venv/bin/pip install -U pip pylint pytest pytest-cov
venv/bin/python -m pylint bcl # Check against linting rules.
venv/bin/python bcl/bcl.py -v # Run doctests.
#venv/bin/python -m nose --cover-erase # Test using nose. # BCl 2.0.0 has succeeded before but but errored at end [due to nose in 3.10 bug](https://github.com/nose-devs/nose/issues/1099)
venv/bin/python -m pytest # Run tests.
- name: Upload wheel file.
run: |
mkdir bcl-wheelhouse
mv wheelhouse/bcl*.whl bcl-wheelhouse/
- uses: actions/upload-artifact@v1
with:
name: "bcl-2.0.0-macOS-arm-${{ matrix.PYTHON.VERSION }}"
name: "bcl-${{ env.RELEASE }}-macOS-arm-${{ matrix.PYTHON.VERSION }}"
path: bcl-wheelhouse/
windows:
runs-on: windows-latest
Expand Down Expand Up @@ -202,15 +204,15 @@ jobs:
run: pip install -f wheelhouse bcl --no-index
- name: Lint and test module (and compiled libsodium shared library file).
run: |
python -m pip install -U pip pylint coverage nose
python -m pip install -U pip pylint pytest pytest-cov
python -m pylint bcl # Check against linting rules.
python bcl/bcl.py -v # Run doctests.
python -m nose --cover-erase # Test using nose.
python -m pytest # Run tests.
- name: Upload wheel file.
run: |
mkdir bcl-wheelhouse
move wheelhouse\bcl*.whl bcl-wheelhouse\
- uses: actions/upload-artifact@v1
with:
name: "bcl-2.0.0-win-${{ matrix.WINDOWS.ARCH }}-${{ matrix.PYTHON.VERSION }}"
name: "bcl-${{ env.RELEASE }}-win-${{ matrix.WINDOWS.ARCH }}-${{ matrix.PYTHON.VERSION }}"
path: bcl-wheelhouse\
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ Testing and Conventions
-----------------------
Before unit tests can be executed, it is first necessary to prepare for local development by compiling and moving into its designated location the libsodium shared library file (as described in `the relevant subsection above <#preparation-for-local-development>`_).

All unit tests are executed and their coverage is measured when using `nose <https://nose.readthedocs.io/>`_ (see ``setup.cfg`` for configution details)::
All unit tests are executed and their coverage is measured when using `pytest <https://docs.pytest.org/>`_ (see ``setup.cfg`` for configuration details)::

python -m pip install nose coverage
nosetests --cover-erase
python -m pip install pytest pytest-cov
python -m pytest

Alternatively, all unit tests are included in the module itself and can be executed using `doctest <https://docs.python.org/3/library/doctest.html>`_::

Expand Down
8 changes: 2 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
[nosetests]
exe=True
with-doctest=1
with-coverage=1
cover-package=bcl
tests=bcl/bcl.py
[tool:pytest]
addopts = --doctest-modules --ignore=docs --cov=bcl --cov-report term-missing

[coverage:run]
omit=bcl/sodium_ffi.py
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def run(self):
long_description = fh.read().replace(".. include:: toc.rst\n\n", "")

name = "bcl"
version = "2.0.2"
version = "2.1.0"

setup(
name=name,
Expand All @@ -187,8 +187,6 @@ def run(self):
"(i.e., public-key) encryption/decryption primitives.",
long_description=long_description,
long_description_content_type="text/x-rst",
test_suite="nose.collector",
tests_require=["nose"],
cffi_modules=["bcl/sodium_ffi.py:sodium_ffi"],
cmdclass={
"build_clib": build_clib,
Expand Down

0 comments on commit 2207f74

Please sign in to comment.