From aa6810ad50dc92d0bb7615d234dffbd3d14c8a9c Mon Sep 17 00:00:00 2001 From: Yohei Kitamura Date: Tue, 15 Dec 2020 17:53:28 -0500 Subject: [PATCH 1/2] Add Protocol Test Suite as Submodule --- .gitmodules | 3 +++ .travis.yml | 1 + CONTRIBUTING.md | 29 ++++++++++++++++++++++------- pytest.ini | 3 --- tests/mauth-protocol-test-suite | 1 + tests/protocol_test_suite_helper.py | 2 +- tests/protocol_test_suite_test.py | 2 -- 7 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 .gitmodules delete mode 100644 pytest.ini create mode 160000 tests/mauth-protocol-test-suite diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..03517ec --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tests/mauth-protocol-test-suite"] + path = tests/mauth-protocol-test-suite + url = https://github.com/mdsol/mauth-protocol-test-suite.git diff --git a/.travis.yml b/.travis.yml index d29b52f..a639363 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: focal language: python cache: pip diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ddf1568..c542229 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,16 +35,31 @@ To setup your environment: pyenv local 3.5.8 3.6.10 3.7.7 3.8.2 pypy3.6-7.1.1 ``` -## Unit Tests - -1. Make any changes, update the tests and then run tests with `tox` -1. Coverage report can be viewed using `open htmlcov/index.html` +## Cloning the Repo -## Running mauth-protocol-test-suite +This repo contains the submodule `mauth-protocol-test-suite` so requires a flag when initially cloning in order to clone and init submodules. -To run the mauth-protocol-test-suite clone the latest test suite onto your machine and place it in the [`tests`](./tests) directory (or supply the ENV var `TEST_SUITE_RELATIVE_PATH` with the path to the test suite relative to the `tests` directory). Then run: +With Git >= 2.13: +```sh +git clone --recurse-submodules git@github.com:mdsol/mauth-client-python.git +``` +With Git < 2.13: +```sh +git clone --recursive git@github.com:mdsol/mauth-client-python.git ``` -poetry run pytest -m protocol_suite + +If you have already cloned before the submodule was introduced, then run: +```sh +cd tests/mauth-protocol-test-suite +git submodule update --init ``` + +to init the submodule. + + +## Unit Tests + +1. Make any changes, update the tests and then run tests with `tox` +1. Coverage report can be viewed using `open htmlcov/index.html` diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 979d72b..0000000 --- a/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -markers = - protocol_suite diff --git a/tests/mauth-protocol-test-suite b/tests/mauth-protocol-test-suite new file mode 160000 index 0000000..303bf5e --- /dev/null +++ b/tests/mauth-protocol-test-suite @@ -0,0 +1 @@ +Subproject commit 303bf5e877d1fd5099dc0ed7fef2c1f8582f36e3 diff --git a/tests/protocol_test_suite_helper.py b/tests/protocol_test_suite_helper.py index 9caf4f1..d986ba9 100644 --- a/tests/protocol_test_suite_helper.py +++ b/tests/protocol_test_suite_helper.py @@ -8,7 +8,7 @@ from mauth_client.signer import Signer -TEST_SUITE_RELATIVE_PATH = os.environ.get("TEST_SUITE_RELATIVE_PATH", "mauth-protocol-test-suite") +TEST_SUITE_RELATIVE_PATH = "mauth-protocol-test-suite" MAUTH_PROTOCOL_DIR = os.path.join(os.path.dirname(__file__), TEST_SUITE_RELATIVE_PATH) CASE_PATH = os.path.join(MAUTH_PROTOCOL_DIR, "protocols/MWSV2") diff --git a/tests/protocol_test_suite_test.py b/tests/protocol_test_suite_test.py index 32c5a17..c48a133 100644 --- a/tests/protocol_test_suite_test.py +++ b/tests/protocol_test_suite_test.py @@ -1,4 +1,3 @@ -import pytest import unittest from unittest.mock import MagicMock from freezegun import freeze_time @@ -23,7 +22,6 @@ def tearDown(self): # reset the KeyHolder.get_public_key method KeyHolder.get_public_key = self.__get_public_key__ - @pytest.mark.protocol_suite @freeze_time(TEST_SUITE.request_time) def test_protocol_test_suite(self): for case_path in TEST_SUITE.cases(): From a99fc1ee4dcf2e547b54418b0b3d3fe46b9324b2 Mon Sep 17 00:00:00 2001 From: Yohei Kitamura Date: Tue, 15 Dec 2020 21:34:47 -0500 Subject: [PATCH 2/2] Update CONTRIBUTING.md --- CONTRIBUTING.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c542229..8c50beb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,18 +38,11 @@ To setup your environment: ## Cloning the Repo -This repo contains the submodule `mauth-protocol-test-suite` so requires a flag when initially cloning in order to clone and init submodules. - -With Git >= 2.13: +This repo contains the submodule `mauth-protocol-test-suite` so requires a flag when initially cloning in order to clone and init submodules: ```sh git clone --recurse-submodules git@github.com:mdsol/mauth-client-python.git ``` -With Git < 2.13: -```sh -git clone --recursive git@github.com:mdsol/mauth-client-python.git -``` - If you have already cloned before the submodule was introduced, then run: ```sh cd tests/mauth-protocol-test-suite