-
Hi. I'm developing a CLI tool using typer, and during installation with pip the tool finds and creates a directory in This has worked fine thus far, but now I want to run tests with tox and I run into the issue that the tests will also use my user's directory, which means the tests cannot test installations in a clean directory, and the tests will also be contaminated with my previous data generated and stored in the config directory. I've searched but I cannot find a solution to this problem, my last try was to edit the Kind regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This cannot be solved by I see a couple of options. If the path which points to You possibly could mock Finally, you could use For |
Beta Was this translation helpful? Give feedback.
This cannot be solved by
tox
-tox
just drivespytest
or any other test runner, but does not test and also not create mocks itself.I see a couple of options. If the path which points to
~/.config
is exposed, you could mock or inject it.You possibly could mock
typer
'sget_app_dir
, although this may cause side effects.Finally, you could use
pyfakefs
which creates a fake file system for the tests only, see http://jmcgeheeiv.github.io/pyfakefs/master/usage.htmlFor
pytest
questions - and this is apytest
question - you could also visit their discord server:https://discord.com/invite/pytest-dev