Skip to content

javiferfer/python-testing-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipenv

Install from Pipfile, if there is one:

$ pipenv install

Or, add a package to your new project:

$ pipenv install <package>

This will create a Pipfile if one doesn’t exist. If one does exist, it will automatically be edited with the new package you provided.

Next, activate the Pipenv shell:

$ pipenv shell
$ python --version

To deactivate the pipenv:

deactivate

Pytest

To run the tests:

pipenv run pytest

To display the output then add the following options:

pipenv run pytest -rx

To run marked test use:

pytest -m <markername> -v

where can be, for this repository:

pipenv run pytest -m great
  • Pipenv install vs pip install

If you are installing using a pipenv environment you should always install your packages using pipenv, this way it will update your pipfile.lock file. Also be careful because pip install will pretty much work anywhere, it's not installing packages to your virtual environment, it's installing them into your computer. Pipenv will update your Pipfile.lock and actually install into your pipenv virtual enviroment if you have one open.

It's rarely a good idea to pip install outside of a virtualenv.

Unittest

pipenv run python tests/assertion/test_unittest_special_assertions.py
pipenv run python -m unittest discover

If the above command is not finding any tests is becuase you didn't create a init.py for every folder: https://stackoverflow.com/questions/5088960/python-m-unittest-discover-does-not-discover-tests

References

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages