Skip to content

Commit

Permalink
Modernize the skipped test_issue_9765 regression test (#12468)
Browse files Browse the repository at this point in the history
* 🚑 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
  • Loading branch information
webknjaz authored Jun 17, 2024
1 parent 80b7657 commit fe4961a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1464,14 +1464,21 @@ def my_fixture(self, request):
}
)

subprocess.run([sys.executable, "setup.py", "develop"], check=True)
subprocess.run(
[sys.executable, "-Im", "pip", "install", "-e", "."],
check=True,
)
try:
# We are using subprocess.run rather than pytester.run on purpose.
# 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
# PYTHONPATH reason.
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:
raise AssertionError(
Expand Down

0 comments on commit fe4961a

Please sign in to comment.