Closed
Description
Since #1837, we import .script
, will imports .flow
, which imports .version
.
This causes the following warning in pytest:
test/mitmproxy/test_version.py::test_version
/Users/kriechi/.pyenv/versions/3.5.3/lib/python3.5/runpy.py:125:
RuntimeWarning: 'mitmproxy.version' found in sys.modules after import of package
'mitmproxy', but prior to execution of 'mitmproxy.version'; this may result in
unpredictable behaviour
warn(RuntimeWarning(msg))
-- Docs: http://doc.pytest.org/en/latest/warnings.html
This next trap exists in all current versions of Python, including 3.3, and can be summed up in the following general guideline: “Never add a package directory, or any directory inside a package, directly to the Python path”.
The reason this is problematic is that every module in that directory is now potentially accessible under two different names: as a top level module (since the directory is on sys.path) and as a submodule of the package (if the higher level directory containing the package itself is also on sys.path).
Maybe using the approach described here works better?