Skip to content

chore: Moving from nose to pytest #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<file_name_without_extension>
pytest tests.<file_name_without_extension>

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.<file_name_without_extension>:ClassName
pytest tests/<file_name_with_extension>::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.<file_name_without_extension>:ClassName.test_name
pytest tests/<file_name_with_extension>::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

Expand Down
8 changes: 4 additions & 4 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -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>=4.6.0
pytest-cov
python-coveralls
pyyaml==5.2
python-coveralls==2.7.0
tabulate==0.7.5