-
Notifications
You must be signed in to change notification settings - Fork 4
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
Rework python version handling associated testconfig path handling. #134
Conversation
5e7692c
to
f531944
Compare
8277ed5
to
edc8c96
Compare
A previous revision fixed an immediate problem with test path handling but knowingly left some things on the table - in particular a split between container based handling of Python 2 and the local execution of Python 3 (meaning a potentially inconsistent version relative to what the project considers officially supported). Address this entirely: rework the default behaviour of `make test` to container based execution and use a consistent baseline Python 3. In order to continue to support rapid local iteration, provide a separate `make unittest` target which will execute the test suite locally and is also used as a mechanism to run other supporting tools. The clean use of containers necessitated various changes that make path arguments within the testconfig non-overlapping and better isolated. Adjust all paths generated within the test suite to be always from the base root instead of relative the output directory. Opt to patch the makeconfig generator rather than fiddle with generateconfs again. While here also add support for an environment variable overried that allows execution of the test suite against arbitrary python 3 versions.
edc8c96
to
5e59ee7
Compare
@@ -0,0 +1,8 @@ | |||
FROM python:3.9 |
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.
I wonder if this comes from an implicit assumption that we prefer python-3.9 due to Rocky9 defaults. Perhaps we should make a brief comment about it if so. Just to make it easier to track once we reach Rocky10.
The alternative would be to pull in a full rocky9 container instead but that may be overkill.
It probably makes little practical difference but if possible we could maybe even track the precise 3.9.N version:
[root@next ~]# cat /etc/redhat-release
Rocky Linux release 9.5 (Blue Onyx)
[root@next ~]# python -V
Python 3.9.21
It tends to remain fixed until the next major distro release.
|
||
overrides = { | ||
'destination': os.path.join(_LOCAL_ENVHELP_OUTPUT_DIR, confs_name), | ||
'destination_suffix': "-%s" % (confs_suffix,), | ||
} | ||
|
||
# determine the paths by which we will access the various configured dirs | ||
if is_py2: | ||
# determine the paths b which we will access the various configured dirs |
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.
Minimal typo, which I can easily fix during merge.
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.
Fixed
@@ -2,7 +2,7 @@ | |||
# | |||
# --- BEGIN_HEADER --- | |||
# | |||
# python3 - wrap python3 virtual environment for testing | |||
# python2 - wrap python2 docker container for testing |
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.
You didn't really mean 2 here, right? Looks copy/pasted from python2 wrapper, so I'll fix during merge unless you protest.
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.
Fixed
|
||
PY2 = (sys.version_info[0] == 2) | ||
from tests.support._env import MIG_ENV, PY2 |
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.
Nitpick: I think we should avoid (especially) leading underscores in module names.
If we don't want it exposed directly in tests.support
I think we should e.g. put it in a sub-dir and have support
__init__
expose only relevant variables explicitly.
Just a piece of general advice and input for the discussed style guide :-)
@@ -146,7 +152,11 @@ def tearDown(self): | |||
if os.path.islink(path): | |||
os.remove(path) | |||
elif os.path.isdir(path): | |||
shutil.rmtree(path) | |||
try: | |||
shutil.rmtree(path) |
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.
Should we insert an assertion here to check that no stray dangerous paths are in play (think '.'
or similar inadvertently ending up in _cleanup_paths
)?
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.
... where '.'
is just an example, which could also be the absolute path of the migrid clone / root directory when one takes the _register_path
assertion about abspath
below into account.
tmp_path = os.path.join(TEST_OUTPUT_DIR, relative_path) | ||
else: | ||
|
||
if os.path.isabs(relative_path): |
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.
A bit tongue-in-cheek nitpicking, but perhaps we should rename relative_path
in a follow-up as it clearly may be absolute in actual use sometimes.
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, it looks good and appears to work as intended in practice. Preparing to merge.
I rebased on |
…are only part of the specific github branches. Reworks python version handling associated testconfig path handling. Credits for the original unit test framework and this unification work to move all tests into containers goes out to Alex Burke (albu-diku). Thanks, Alex! :) I only did a bit of minor polish as explained in #134 git-svn-id: svn+ssh://svn.code.sf.net/p/migrid/code/trunk@6195 b75ad72c-e7d7-11dd-a971-7dbc132099af
…are only part of the specific github branches. Reworks python version handling associated testconfig path handling. Credits for the original unit test framework and this unification work to move all tests into containers goes out to Alex Burke (albu-diku). Thanks, Alex! :) I only did a bit of minor polish as explained in #134 git-svn-id: svn+ssh://svn.code.sf.net/p/migrid/code/trunk@6195 b75ad72c-e7d7-11dd-a971-7dbc132099af
Thanks, Alex 👍 |
Marked with follow-up pending. Please to go over the comments above and see if anything should be addressed in separate PRs. |
A previous revision fixed an immediate problem with test path handling
but knowingly left some things on the table - in particular a split
between container based handling of Python 2 and the local execution
of Python 3 (meaning a potentially inconsistent version relative to
what the project considers officially supported).
Address this entirely: rework the default behaviour of
make test
tocontainer based execution and use a consistent baseline Python 3.
In order to continue to support rapid local iteration, provide a
separate
make unittest
target which will execute the test suitelocally and is also used as a mechanism to run other supporting tools.
The clean use of containers necessitated various changes that make path
arguments within the testconfig non-overlapping and better isolated.
Adjust all paths generated within the test suite to be always from the
base root instead of relative the output directory. Opt to patch the
makeconfig generator rather than fiddle with generateconfs again.
While here also add support for an environment variable override that
allows execution of the test suite against arbitrary python 3 versions.