From 630724d2c05d5077e2fdc7847bc84ecdbc289fa8 Mon Sep 17 00:00:00 2001 From: aliabbasrizvi Date: Wed, 17 Jun 2020 19:19:59 -0700 Subject: [PATCH 1/4] Moving to pytest --- .travis.yml | 2 +- README.md | 20 ++++++++++---------- requirements/test.txt | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8ae93ba2..c45faaf8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ python: - "pypy" - "pypy3" install: "pip install -r requirements/core.txt;pip install -r requirements/test.txt" -script: "nosetests --with-coverage --cover-package=optimizely" +script: "pytest --cov=optimizely" after_success: - coveralls diff --git a/README.md b/README.md index 0bd1d87b..ab4db393 100644 --- a/README.md +++ b/README.md @@ -163,41 +163,41 @@ install command: You can run all unit tests with: - nosetests + pytest #### Running all tests in a file To run all tests under a particular test file you can use the following command: - nosetests tests. + pytest tests. -For example, to run all tests under `test_event`, the command would be: +For example, to run all tests under `test_event_builder`, the command would be: - nosetests tests.test_event + pytest tests/test_event_builder.py #### Running all tests under a class To run all tests under a particular class of tests you can use the following command: - nosetests tests.:ClassName + pytest tests/::ClassName -For example, to run all tests under `test_event.EventTest`, the command +For example, to run all tests under `test_event_builder.EventTest`, the command would be: - nosetests tests.test_event:EventTest + pytest tests/test_event_builder.py::EventTest #### Running a single test To run a single test you can use the following command: - nosetests tests.:ClassName.test_name + pytest tests/::ClassName::test_name -For example, to run `test_event.EventTest.test_dispatch`, the command +For example, to run `test_event_builder.EventTest.test_init`, the command would be: - nosetests tests.test_event:EventTest.test_dispatch + pytest tests/test_event_builder.py::EventTest::test_init ### Contributing diff --git a/requirements/test.txt b/requirements/test.txt index 9b3e780f..ab525d9f 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,8 +1,8 @@ -coverage>=4.0.3 +coverage flake8==3.6.0 funcsigs==0.4 mock==1.3.0 -nose==1.3.7 +pytest +python-coveralls pyyaml==5.2 -python-coveralls==2.7.0 tabulate==0.7.5 From 94c08218273786b260b7003e080d30e155c9283f Mon Sep 17 00:00:00 2001 From: aliabbasrizvi Date: Wed, 17 Jun 2020 19:21:55 -0700 Subject: [PATCH 2/4] getting rid of tabulate --- requirements/test.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements/test.txt b/requirements/test.txt index ab525d9f..58ba58a2 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -5,4 +5,3 @@ mock==1.3.0 pytest python-coveralls pyyaml==5.2 -tabulate==0.7.5 From aa1516a44047c3fe9e706d57aef3b2a45865d53c Mon Sep 17 00:00:00 2001 From: aliabbasrizvi Date: Thu, 18 Jun 2020 09:16:52 -0700 Subject: [PATCH 3/4] Adding pytest-cov --- requirements/test.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements/test.txt b/requirements/test.txt index 58ba58a2..febf9a0a 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -3,5 +3,6 @@ flake8==3.6.0 funcsigs==0.4 mock==1.3.0 pytest +pytest-cov python-coveralls pyyaml==5.2 From edcf5ca46b471dad81a8d8f92464a1bb961c99e4 Mon Sep 17 00:00:00 2001 From: aliabbasrizvi Date: Thu, 18 Jun 2020 09:28:53 -0700 Subject: [PATCH 4/4] Setting version --- requirements/test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/test.txt b/requirements/test.txt index febf9a0a..e56cf624 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -2,7 +2,7 @@ coverage flake8==3.6.0 funcsigs==0.4 mock==1.3.0 -pytest +pytest>=4.6.0 pytest-cov python-coveralls pyyaml==5.2