Skip to content
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

patch st2-run-pack-tests to work with python3 #4956

Closed
wants to merge 4 commits into from

Conversation

guzzijones
Copy link
Contributor

allows st2-run-pack-tests to work with python3 on systems that have python3 installed as a separate binary.

I probably need to find and or create an integration test for this.

@pull-request-size pull-request-size bot added size/S PR that changes 10-29 lines. Very easy to review. size/M PR that changes 30-99 lines. Good size to review. and removed size/S PR that changes 10-29 lines. Very easy to review. labels May 20, 2020
@guzzijones
Copy link
Contributor Author

I see 2 places where this script is called:
https://github.com/StackStorm/st2/blob/b54262709f02b17acb716ed12efc651c71e1405d/Makefile
https://github.com/StackStorm/st2/blob/2b7c4005243fc268497b6780333241e9fc712f82/tox.ini

Adding a test of the -3 will require a git clone of the repo and setting the ST2_REPO_PATH and then running .

@arm4b
Copy link
Member

arm4b commented May 23, 2020

@nzlosh Can you please help evaluating UX functionality/changes in this PR and review it?

@nzlosh
Copy link
Contributor

nzlosh commented May 24, 2020

Can I have some more context about the problem this PR is addressing? On Ubuntu 18.04 the st2-run-pack-tests detects and uses python3.6 to test the pack without any problem. Running the script with -3 returns must set ST2_REPO_PATH variable

@guzzijones
Copy link
Contributor Author

guzzijones commented May 25, 2020 via email

@guzzijones
Copy link
Contributor Author

guzzijones commented May 25, 2020 via email

@arm4b
Copy link
Member

arm4b commented May 25, 2020

Here is the complete py2 vs py3 native OS support matrix:

Python 3:

  • EL8
  • Ubuntu Bionic

Python 2:

  • EL6 (will be deprecated in st2 v3.3)
  • EL7
  • Ubuntu Xenial

@arm4b
Copy link
Member

arm4b commented May 30, 2020

@nzlosh did @guzzijones answer your question?
Any further PR review/feedback based on that context?

Copy link
Contributor

@nzlosh nzlosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, adding support for Python3 looks good to me. There are a few points I've raised, such as allowing the users to choose the version of python used for the pack tests and some more explicit error messages.

@@ -78,10 +80,11 @@ function usage() {
echo " and virtualenv, if any, for subsequent test runs." >&2
echo " -t : Run tests with timing enabled" >&2
echo " -v : Verbose mode (log debug messages to stdout)." >&2
echo " -3 : use python3" >&2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a flag that takes an argument rather than hard coding 3 (hint: use $OPTARG to get the version).

3 doesn't give any meaning to the purpose of the flag, using P would be better so there is an association with P for Python. It would be useful to be able to specify a version rather than just the major version. E.g. accept 3.6, 3.7, 3.8 to give pack developers the flexibility to test against a specific minor version.

Remember to document the flag in the Usage: $0 section of the output too.

@@ -104,6 +107,14 @@ while getopts ":p:f:xjvct" o; do
t)
ENABLE_TIMING=true
;;
3)
PYTHON_3=true
if [ -z "$ST2_REPO_PATH" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the python 3 flag short circuit the ST2_REPO_PATH logic which handles the case of its absence later in the script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the most important part. This script will look for st2 libs in \opt\stsckstorm if i dont set this. On centos7 those are python 2.7. Maybe what we do here is check the system python version vs. The version passed in this flag. If they doffer then force this env var to be set.

3)
PYTHON_3=true
if [ -z "$ST2_REPO_PATH" ]; then
echo "must set ST2_REPO_PATH variable"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A clearer error message explaining what the ST2_REPO_PATH variable is used for will help people set the correct value. e.g. Environment variable ST2_REPO_PATH must be set to your st2 installation or st2 git repository for pack tests to function correctly.

@guzzijones
Copy link
Contributor Author

Just a heads up:
If this gets milestone I will spend some time on it. Currently I am working on other PRs.

@arm4b
Copy link
Member

arm4b commented Jun 1, 2020

@guzzijones Yes, we'll be good to accept this enhancement into st2 core, once it's polished.

Thanks @nzlosh for helping with the review to get it closer for the broader use.

@arm4b
Copy link
Member

arm4b commented Aug 13, 2020

@guzzijones any update on driving this PR to completion?

@cognifloyd
Copy link
Member

We do not support python2 now, so is this needed anymore?

@amanda11
Copy link
Contributor

We do not support python2 now, so is this needed anymore?

I don't think so, the last two ST2 releases (3.4 and 3.5) do not support python2.

@cognifloyd
Copy link
Member

I'm going to close this then. If we still need it for some reason, feel free to reopen.

@cognifloyd cognifloyd closed this Jul 23, 2021
@arm4b
Copy link
Member

arm4b commented Jul 25, 2021

Closing due to py2 is not relevant anymore and we're on py3 sounds 👍
Thanks @cognifloyd for spotting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement size/M PR that changes 30-99 lines. Good size to review. status:needs changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants