Geek Logbook

Tech sea log book

TOX: First steps

Tox is a tool for Python testing. I’m doing my first steps because I found it in the project: Faker, which is:

Faker is a Python package that generates fake data for you. 

Faker Git Hub repository

If you want an interesting video explanation about that you can see anthony explains #043

You can install it using pip:

python -m pip install --user tox
python -m tox --help

In the documentation you can find other ways to install it: tox installation

Once installed you can run the command to run the tests in your repository:

Run tests:

tox

If you plan yo use for the first time and run the tests using tox you have to create a configuration file: tox.ini. For example in Faker you can find the configuration file: tox.ini on faker git hub

So, for example, if you only want to create a document after the run, in the case of faker you can run the following:

 python -m faker > docs.txt

You need to take into consideration that you need to have installed dateutil if you don’t have this library you won’t be able to run this command because you’re going to receive the following error:

ModuleNotFoundError: No module named 'dateutil'

This Stack Overflow question is related as the problem you could have: ImportError: No module named dateutil.parser the solution if you are using Windows is install the library using pip:

pip install dateutil
Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*
You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>