'how to configure tox for getting the logs
I am trying to use tox automating testing in my project. But I am not able to figure out where the logs or prints from my test_methods in python file goes while using tox. I also grepped the entire tox directory for logs but couldn't find it.
Questions
1) How to configure log directory in tox ?
2) What is the default configuration for logs ?
Any Pointers to the documentation and examples ?
My tox.ini file
[tox]
minversion = 1.6
skipsdist = True
[testenv]
skip_install = True
setenv =
VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
passenv = LANG
[testenv:test]
commands = ./test.sh --slowest --testr-args='{posargs}'
Solution 1:[1]
it's not really an answer, but I ended up using asserts.. so instead of
print(type(x))
I do
assert type(x)==1
which gives me
E AssertionError: assert <class 'tuple'> == 1
... so it's a tuple.. A bit crap but it works
Solution 2:[2]
- There's
envlogdir
exactly for that:
envlogdir=path
defines a directory for logging where tox will put logs of tool invocation. default: {envdir}/log
- By default your testrunner's logs are in
./.tox/envname/log/envname-k.log
whereenvname
is environment name (e.g.py27
) andk
is number of the command which actually runs your testrunner (python -m testtools.run
).k==0
isenvname
creation log,k==1
is log for first dependency installation, etc.
Solution 3:[3]
You can use --verbose
and throw error intentionaly to print out log
Example:
print('HERE')
assertTrue(False)
tox -e unit-tests --verbose
Solution 4:[4]
If you use Linux, you can simply log the test using:
tox > toxlog.txt
And the output will be in the toxlog.txt file
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Michael Dausmann |
Solution 2 | |
Solution 3 | |
Solution 4 | Aminu Israel |