Modernize the skipped `test_issue_9765` regression test (#12468)
* 🚑 Explicitly set encoding @ `subprocess.run()` This invocation is present in the `test_issue_9765` regression test that is always skipped unconditionally, resulting in the `EncodingWarning` never manifesting itself in CI or development environments of the contributors. * Change `setup.py` call w/ `pip install` @ tests Using this CLI interface has been deprecated in `setuptools` [[1]]. [1]: https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html
This commit is contained in:
parent
80b7657b2a
commit
fe4961afae
|
@ -1464,14 +1464,21 @@ def test_issue_9765(pytester: Pytester) -> None:
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
subprocess.run([sys.executable, "setup.py", "develop"], check=True)
|
subprocess.run(
|
||||||
|
[sys.executable, "-Im", "pip", "install", "-e", "."],
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
# We are using subprocess.run rather than pytester.run on purpose.
|
# We are using subprocess.run rather than pytester.run on purpose.
|
||||||
# pytester.run is adding the current directory to PYTHONPATH which avoids
|
# pytester.run is adding the current directory to PYTHONPATH which avoids
|
||||||
# the bug. We also use pytest rather than python -m pytest for the same
|
# the bug. We also use pytest rather than python -m pytest for the same
|
||||||
# PYTHONPATH reason.
|
# PYTHONPATH reason.
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["pytest", "my_package"], capture_output=True, check=True, text=True
|
["pytest", "my_package"],
|
||||||
|
capture_output=True,
|
||||||
|
check=True,
|
||||||
|
encoding="utf-8",
|
||||||
|
text=True,
|
||||||
)
|
)
|
||||||
except subprocess.CalledProcessError as exc:
|
except subprocess.CalledProcessError as exc:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
|
|
Loading…
Reference in New Issue