mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Improve ansible-test environment checking between tests. (#46459)
* Add unified diff output to environment validation. This makes it easier to see where the environment changed. * Compare Python interpreters by version to pip shebangs. This helps expose cases where pip executables use a different Python interpreter than is expected. * Query `pip.__version__` instead of using `pip --version`. This is a much faster way to query the pip version. It also more closely matches how we invoke pip within ansible-test. * Remove redundant environment scan between tests. This reuses the environment scan from the end of the previous test as the basis for comparison during the next test.
This commit is contained in:
15
test/runner/versions.py
Executable file
15
test/runner/versions.py
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
"""Show python and pip versions."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import pip
|
||||
except ImportError:
|
||||
pip = None
|
||||
|
||||
print(sys.version)
|
||||
|
||||
if pip:
|
||||
print('pip %s from %s' % (pip.__version__, os.path.dirname(pip.__file__)))
|
||||
Reference in New Issue
Block a user