I have a project, let's say called 'my_project' with the following structure:
my_project
|
tox.ini
setup.py
src
|
client.py
server.py
config.json
# other files
tests.py
The classes defined in files client.py and server.py use information contained in config.json and tests.py implements the py.test tests for each file in folder src. Inside the client/server files I read the config file as follows:
with open('./config.json') as infile:
self.parameters = json.load(infile)
Next, I created a tox.ini file as follows:
[tox]
envlist = py27,cov
[testenv]
#commands = py.test --cov=src/client.py src/tests.py -v
commands = py.test -sv --doctest-modules src/__init__.py src/tests.py
[testenv:py27]
commands = coverage erase
coverage run --source=src -m pytest
coverage report -m
deps = pytest
But when I run the tox command I get an error: "No such file or directory: 'config.json'". How can I setup up the correct path to make sure that tox can find all necessary files?
Aucun commentaire:
Enregistrer un commentaire