New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vendor py.path and py.error #10396
vendor py.path and py.error #10396
Conversation
4e2ccb9
to
05b6c96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That particular hack hurts in a special way
import _pytest._py.error as error | ||
import _pytest._py.path as path | ||
|
||
sys.modules["py.error"] = error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks i hate it, but it's a fun hack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh -- it's basically what apipkg
does iirc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but the overreaching hack into the python import system to be backward compatible in this "yikes this works" way is quite something
I guess I should finish the linting and typing for |
for more information, see https://pre-commit.ci
@RonnyPfannschmidt so you are OK with vendoring I personally like vendoring it, as we can drop In addition, we should also port the tests for |
5d9f74b
to
dc0cb0d
Compare
Hi,
I'll leave it to you to decide if it is worth it to add back that support (downstream developers can easily add a couple of ignores, especially knowing that Cheers, |
@francesco-ballarin I opened #10435 for this. Maybe there's an easy way we can fix this, but in here, this is likely to get lost. |
With pytest 7.2, the remaining parts of the "py.path" library got vendored, to get rid of the dependency: pytest-dev/pytest#10396 However, this breaks due to pytest_mypy_plugins importing private API: File ".../pytest_mypy_plugins/collect.py", line 13, in <module> from py._path.local import LocalPath ModuleNotFoundError: No module named 'py._path'; 'py' is not a package Use py.path.local instead (the public name of the same type), which is part of the shim included in pytest.
With pytest 7.2, the remaining parts of the "py.path" library got vendored, to get rid of the dependency: pytest-dev/pytest#10396 However, this breaks due to pytest_mypy_plugins importing private API: File ".../pytest_mypy_plugins/collect.py", line 13, in <module> from py._path.local import LocalPath ModuleNotFoundError: No module named 'py._path'; 'py' is not a package Use py.path.local instead (the public name of the same type), which is part of the shim included in pytest.
With pytest 7.2, the remaining parts of the "py.path" library got vendored, to get rid of the dependency: pytest-dev/pytest#10396 However, this breaks due to pytest_mypy_plugins importing private API: File ".../pytest_mypy_plugins/collect.py", line 13, in <module> from py._path.local import LocalPath ModuleNotFoundError: No module named 'py._path'; 'py' is not a package Use py.path.local instead (the public name of the same type), which is part of the shim included in pytest.
The py dependency has been removed in pytest: pytest-dev/pytest#10396
Since pytest-dev/pytest#10396 the py library is no longer installed, but dumb-init needs 'py._path'. Fixes: ImportError while importing test module '/tmp/tmp.k8zSDBKT6S/dumb-init-1.2.5/tests/child_processes_test.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /usr/lib/python3.8/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) tests/child_processes_test.py:10: in <module> from testing import is_alive testing/__init__.py:11: in <module> from py._path.local import LocalPath E ModuleNotFoundError: No module named 'py._path'; 'py' is not a package Issue filed upstream: Yelp/dumb-init#286 Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Append 'py' to dumb-init*/requirements-dev.txt Since pytest-dev/pytest#10396 the py library is no longer installed, but dumb-init needs 'py._path'. Fixes: ImportError while importing test module '/tmp/tmp.k8zSDBKT6S/dumb-init-1.2.5/tests/child_processes_test.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /usr/lib/python3.8/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) tests/child_processes_test.py:10: in <module> from testing import is_alive testing/__init__.py:11: in <module> from py._path.local import LocalPath E ModuleNotFoundError: No module named 'py._path'; 'py' is not a package Issue filed upstream: Yelp/dumb-init#286 Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Append 'py' to dumb-init*/requirements-dev.txt Since pytest-dev/pytest#10396 the py library is no longer installed, but dumb-init needs 'py._path'. Fixes: ImportError while importing test module '/tmp/tmp.k8zSDBKT6S/dumb-init-1.2.5/tests/child_processes_test.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /usr/lib/python3.8/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) tests/child_processes_test.py:10: in <module> from testing import is_alive testing/__init__.py:11: in <module> from py._path.local import LocalPath E ModuleNotFoundError: No module named 'py._path'; 'py' is not a package Issue filed upstream: Yelp/dumb-init#286 Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Append 'py' to dumb-init*/requirements-dev.txt Since pytest-dev/pytest#10396 the py library is no longer installed, but dumb-init needs 'py._path'. Fixes: ImportError while importing test module '/tmp/tmp.k8zSDBKT6S/dumb-init-1.2.5/tests/child_processes_test.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /usr/lib/python3.8/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) tests/child_processes_test.py:10: in <module> from testing import is_alive testing/__init__.py:11: in <module> from py._path.local import LocalPath E ModuleNotFoundError: No module named 'py._path'; 'py' is not a package Issue filed upstream: Yelp/dumb-init#286 Signed-off-by: Tim Orling <tim.orling@konsulko.com>
The py dependency has been removed in pytest: pytest-dev/pytest#10396
pytest-dev/pytest#10396 git-svn-id: file:///srv/repos/svn-community/svn@1340954 9fca08f4-af9d-4005-b8df-a31f2cc04f65
pytest-dev/pytest#10396 git-svn-id: file:///srv/repos/svn-community/svn@1340954 9fca08f4-af9d-4005-b8df-a31f2cc04f65
python-py was brought in by older pytest [1][2] [1] 6687aae [2] pytest-dev/pytest#10396 git-svn-id: file:///srv/repos/svn-community/svn@1342284 9fca08f4-af9d-4005-b8df-a31f2cc04f65
python-py was brought in by older pytest [1][2] [1] 6687aae [2] pytest-dev/pytest#10396 git-svn-id: file:///srv/repos/svn-community/svn@1342284 9fca08f4-af9d-4005-b8df-a31f2cc04f65
there is one tiny behavioural change -- that is🤷
sysexec
now raisesRuntimeError
instead of a sepcializedpy.process.cmdexec
error -- I think this is probably fine, I doubt anyone is actually usingpy.path.local.sysexec
otherwise we could vendor that module too -- but seems not worth