python-alura
While Python has a built-in module called venv
, you can also use the virtualenv
package if you prefer more features. To install it, run:
pip install virtualenv
-
Using
venv
(Python 3.3+ comes withvenv
built-in):python -m venv myenv
-
Using
virtualenv
:virtualenv myenv
Replace myenv
with the name of your virtual environment.
-
On Windows:
myenv\Scripts\activate
-
On macOS/Linux:
source myenv/bin/activate or source /home/all-an/Public/code/python-alura/myenv/bin/activate
When you're done, deactivate it by running:
deactivate
pip3 install pytest
pytest
or
pytest -v # verbose mode
# will run the first test
pytest -k idade
or
pytest -k idade -v
pytest -v -m calcular_bonus
pytest --markers
Example: If you use mark @mark.skip and run pytest, you will skip the test with the mark
pip install pytest-cov==3.0.0
pytest --cov
pytest --cov=bytebank
# will run coverage only on bytebank.py file
pytest --cov=bytebank --cov-report term-missing
The new Missing column on the report is the line of code not covered
pytest --cov=bytebank --cov-report html
pytest --junitxml report.xml
pytest --cov-report xml