Skip to content
Closed
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
21e34fb
Update pymongo and mongoengine to display deprecation warnings.
nzlosh Feb 28, 2024
1ad6c34
Bump version for py3.10 support
nzlosh Mar 6, 2024
634a7b3
Replace nose with pytest
nzlosh Mar 12, 2024
2102851
Remove unittest2, switch nosetest to pytest
nzlosh Mar 12, 2024
12b8254
update requirements
nzlosh Mar 12, 2024
071c2b0
Replace nosetest with pytest (without concurrency)
nzlosh Mar 12, 2024
a1d35a7
Fix for DeprecationWarning: Please use assertRaisesRegex
nzlosh Mar 12, 2024
ca7db1d
Fix DeprecationWarning: The 'warn' method is deprecated, use 'warning…
nzlosh Mar 12, 2024
4cbbdfc
Fix DeprecationWarning: Please use assertRegex instead.
nzlosh Mar 12, 2024
848d9c2
Fix for DeprecationWarning: Please use assertNotEqual instead.
nzlosh Mar 12, 2024
21ebac7
Fix for DeprecationWarning: the imp module is deprecated in favour of…
nzlosh Mar 13, 2024
7d3990e
Fix ssl_cert_reqs choices and update data type of newer version of os…
nzlosh Mar 13, 2024
9753982
Enable testing with py3.10
nzlosh Mar 13, 2024
a87373c
Fixed more DeprecationWarning: The 'warn' method is deprecated, use '…
nzlosh Mar 13, 2024
b4a915c
Bump kombu to add py3.10 support.
nzlosh Mar 13, 2024
6cda1dd
Regenerate pants lockfile with py3.10 support enabled.
nzlosh Mar 13, 2024
5dcc31c
Bump prompt-toolkit to 3.0.43 for py3.10 support
nzlosh Mar 13, 2024
be108b3
Replace 'warn' with 'warning' method
nzlosh Mar 13, 2024
d8657cc
Switch python-editor to editor for py3.10 support.
nzlosh Mar 13, 2024
e09c0ac
Update pants lockfiles with py3.10 support
nzlosh Mar 13, 2024
a5c0483
Bumped prance to 23.6.21.0 for py3.10 support.
nzlosh Mar 14, 2024
6b55018
Black formatting
nzlosh Mar 14, 2024
758eb65
Use pygment token in place of prompt_toolkit
nzlosh Mar 14, 2024
5116589
Relax pinning for amqp, update pants requirements to align with fixed…
nzlosh Mar 14, 2024
9913406
Remove editor.EditorError since editor defaults to output redirection…
nzlosh Mar 14, 2024
c5b1943
Update pygment to be included in st2client and bump argcomplete to su…
nzlosh Mar 14, 2024
45c256a
Update pants lockfile to include Pygment
nzlosh Mar 14, 2024
c574b29
Fix for DeprecationWarning: This method will be removed in Python 3.1…
nzlosh Mar 14, 2024
9f72797
Skip test_warn_on_bad_config_permissions when run as root user.
nzlosh Mar 14, 2024
861af2f
Skip test_get_cached_auth_token_invalid_permissions if run as root
nzlosh Mar 14, 2024
999aa4f
Test for alternative argparse text on py3.10 for test_help_command_li…
nzlosh Mar 14, 2024
bcc74d8
Bump semver for py3.10 and fix DeprecationWarning: Function semver.ma…
nzlosh Mar 14, 2024
6aaaaaf
Fix semver patch strip function and replace deprecated self.assertIte…
nzlosh Mar 14, 2024
2368557
Removed test for application_headers when no compression enabled.
nzlosh Mar 18, 2024
33af575
Fix bash syntax error in test_pause_resume_with_error
nzlosh Mar 19, 2024
c2d9d01
Bump Jinja2 + MarkupSafe to support py3.10
nzlosh Mar 19, 2024
2998a0d
Pytest compatibility - Add stub test files for local/remote runners t…
nzlosh Mar 19, 2024
02b7beb
Port fixed-requirements constraints to pants and regenerate lockfiles.
nzlosh Mar 21, 2024
0b0d677
Bump jinja2 to support py3.10 and remove nose from test requirements.
nzlosh Mar 26, 2024
ddf4fbb
Test: Bump pylint and astroid to latest 2.x
nzlosh Mar 27, 2024
de424bd
Remove options to fix pylint Unknown option value warning.
nzlosh Mar 29, 2024
2c15886
Fix Useless option value for W0142, W0232 and R0201
nzlosh Mar 29, 2024
12b9eda
Fix E0601: Using variable 'result' before assignment (used-before-ass…
nzlosh Mar 29, 2024
d18fb02
Bump linting tools and update pylint code for compatibility.
nzlosh Mar 29, 2024
a6a0bfd
Fix E721 do not compare types
nzlosh Mar 29, 2024
a804694
Initialise variables to avoid E0601: Use before assignment.
nzlosh Mar 29, 2024
bdfbd77
Bump pylint and astroid to support latest dnspython.
nzlosh Mar 31, 2024
15a2b6e
Update pylint calls for support 3.1
nzlosh Mar 31, 2024
48b1ced
Update requirements and pants lockfiles with module pinning for py3.8…
nzlosh Apr 2, 2024
4668ed5
Fix E0601: used-before-assign lint errors.
nzlosh Apr 3, 2024
02d2c3d
Disable linting on pants-plugins due to unresolvable conflicting cons…
nzlosh Apr 3, 2024
647fca8
Disable false alert on import error.
nzlosh Apr 3, 2024
1659e96
More dependency tweaks and update commandline for pip-compile
nzlosh Apr 3, 2024
9174603
Update pygment and redis pinning to avoid version conflicts in st2cli…
nzlosh Apr 4, 2024
e04e25e
Update launchdev.sh to use tmux instead of screen which is deprecated…
nzlosh Apr 8, 2024
7b17a85
Merge branch 'master' into mongo_upgrade
cognifloyd May 16, 2024
b928290
include py3.10 in pants lockfiles
cognifloyd May 2, 2024
3167134
loosen some fixed requirements
cognifloyd May 17, 2024
ec74e43
revert some pants changes
cognifloyd May 17, 2024
eb9d408
remove some constraints from lockfiles/st2-constraints.txt
cognifloyd May 17, 2024
4dbcc36
Regenerate lockfiles/st2.lock
cognifloyd May 17, 2024
bd629b4
update fixed-requirements.txt using versions from lockfiles/st2.lock
cognifloyd May 17, 2024
aba09f3
Remove std lib dep (argparse) from requirements
cognifloyd May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
- name: 'Test (pants runs: pytest)'
python-version-short: '3.9'
python-version: '3.9.14'
- name: 'Test (pants runs: pytest)'
python-version-short: '3.10'
python-version: '3.10.12'

services:
mongo:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Changed
~~~~~~~
* Bumped `jsonschema` 2.6.0 -> 3.2.0 now that python3.6 is not supported. #6118

* Support for Python3.8, Python3.9 and Python3.10. Update underlying modules and
remove modules that weren't compatible with newer versions of Python. #6157

Added
~~~~~
* Continue introducing `pants <https://www.pantsbuild.org/docs>`_ to improve DX (Developer Experience)
Expand Down
41 changes: 20 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ REQUIREMENTS := test-requirements.txt requirements.txt

# Pin common pip version here across all the targets
# Note! Periodic maintenance pip upgrades are required to be up-to-date with the latest pip security fixes and updates
PIP_VERSION ?= 20.3.3
# 202403: Use pip 24.0 which is the highest supported version across Python 3.8 - 3.10
PIP_VERSION ?= 24.0
SETUPTOOLS_VERSION ?= 51.3.3
PIP_OPTIONS := $(ST2_PIP_OPTIONS)

Expand All @@ -73,6 +74,9 @@ endif
# The minus in front of st2.st2common.bootstrap filters out logging statements from that module.
# See https://nose.readthedocs.io/en/latest/usage.html#cmdoption-logging-filter
NOSE_OPTS := --rednose --immediate --with-parallel --parallel-strategy=FILE --nocapture --logging-filter=-st2.st2common.bootstrap
# https://github.com/pytest-dev/pytest-xdist/issues/71
#PYTEST_OPTS := -n auto --tx 2*popen//execmodel=eventlet
PYTEST_OPTS := ""

ifndef NOSE_TIME
NOSE_TIME := yes
Expand Down Expand Up @@ -486,7 +490,7 @@ flake8: requirements .flake8
. $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 pylint_plugins/

# Make task which verifies st2client README will parse pypi checks
. PHONY: .st2client-pypi-check
.PHONY: .st2client-pypi-check
.st2client-pypi-check:
@echo
@echo "==================== st2client pypi check ===================="
Expand Down Expand Up @@ -735,8 +739,8 @@ check-dependency-conflicts:
@echo
# Verify there are no conflicting dependencies
cat st2*/requirements.txt contrib/runners/*/requirements.txt | sort -u > req.txt && \
$(VIRTUALENV_DIR)/bin/pip-compile req.txt || exit 1; \
if [[ -e req.txt ]]; then rm req.txt; fi
$(VIRTUALENV_DIR)/bin/pip-compile --strip-extras --output-file req.out req.txt || exit 1; \
rm -f req.txt req.out

.PHONY: virtualenv
# Note: We always want to update virtualenv/bin/activate file to make sure
Expand Down Expand Up @@ -823,8 +827,7 @@ unit-tests: requirements .unit-tests
echo "Running tests in" $$component; \
echo "-----------------------------------------------------------"; \
. $(VIRTUALENV_DIR)/bin/activate; \
nosetests $(NOSE_OPTS) -s -v \
$$component/tests/unit || exit 1; \
pytest --capture=no --verbose $$component/tests/unit || exit 1; \
echo "-----------------------------------------------------------"; \
echo "Done running tests in" $$component; \
echo "==========================================================="; \
Expand All @@ -846,8 +849,7 @@ endif
echo "-----------------------------------------------------------"; \
. $(VIRTUALENV_DIR)/bin/activate; \
COVERAGE_FILE=.coverage.unit.$$(echo $$component | tr '/' '.') \
nosetests $(NOSE_OPTS) -s -v $(NOSE_COVERAGE_FLAGS) \
$(NOSE_COVERAGE_PACKAGES) \
pytest --capture=no --verbose $(PYTEST_OPTS) --cov=$$component --cov-branch \
$$component/tests/unit || exit 1; \
echo "-----------------------------------------------------------"; \
echo "Done running tests in" $$component; \
Expand Down Expand Up @@ -902,7 +904,7 @@ itests: requirements .itests
echo "Running integration tests in" $$component; \
echo "-----------------------------------------------------------"; \
. $(VIRTUALENV_DIR)/bin/activate; \
nosetests $(NOSE_OPTS) -s -v \
pytest --capture=no --verbose $(PYTEST_OPTS) \
$$component/tests/integration || exit 1; \
echo "-----------------------------------------------------------"; \
echo "Done running integration tests in" $$component; \
Expand All @@ -925,8 +927,7 @@ endif
echo "-----------------------------------------------------------"; \
. $(VIRTUALENV_DIR)/bin/activate; \
COVERAGE_FILE=.coverage.integration.$$(echo $$component | tr '/' '.') \
nosetests $(NOSE_OPTS) -s -v $(NOSE_COVERAGE_FLAGS) \
$(NOSE_COVERAGE_PACKAGES) \
pytest --capture=no --verbose $(PYTEST_OPTS) --cov=$$component --cov-branch \
$$component/tests/integration || exit 1; \
echo "-----------------------------------------------------------"; \
echo "Done integration running tests in" $$component; \
Expand All @@ -942,8 +943,7 @@ endif
echo "==========================================================="; \
. $(VIRTUALENV_DIR)/bin/activate; \
COVERAGE_FILE=.coverage.integration.$$(echo $$component | tr '/' '.') \
nosetests $(NOSE_OPTS) -s -v \
$(NOSE_COVERAGE_FLAGS) $(NOSE_COVERAGE_PACKAGES) $$component/tests/integration || exit 1; \
pytest --capture=no --verbose $(PYTEST_OPTS) --cov=$$component --cov-branch $$component/tests/integration || exit 1; \
done
# NOTE: If you also want to run orquesta tests which seem to have a bunch of race conditions, use
# ci-integration-full target
Expand Down Expand Up @@ -1037,16 +1037,15 @@ orquesta-itests: requirements .orquesta-itests
@echo "==================== Orquesta integration tests ===================="
@echo "The tests assume st2 is running on 127.0.0.1."
@echo
. $(VIRTUALENV_DIR)/bin/activate; nosetests $(NOSE_OPTS) -s -v st2tests/integration/orquesta || exit 1;
. $(VIRTUALENV_DIR)/bin/activate; pytest --capture=no --verbose $(PYTEST_OPTS) st2tests/integration/orquesta || exit 1;

.PHONY: .orquesta-itests-coverage-html
.orquesta-itests-coverage-html:
@echo
@echo "==================== Orquesta integration tests with coverage (HTML reports) ===================="
@echo "The tests assume st2 is running on 127.0.0.1."
@echo
. $(VIRTUALENV_DIR)/bin/activate; nosetests $(NOSE_OPTS) -s -v --with-coverage \
--cover-inclusive --cover-html st2tests/integration/orquesta || exit 1;
. $(VIRTUALENV_DIR)/bin/activate; pytest --capture=no --verbose $(PYTEST_OPTS) --cov=orquesta --cov-branch st2tests/integration/orquesta || exit 1;

.PHONY: packs-tests
packs-tests: requirements .packs-tests
Expand Down Expand Up @@ -1075,7 +1074,7 @@ runners-tests: requirements .runners-tests
echo "==========================================================="; \
echo "Running tests in" $$component; \
echo "==========================================================="; \
. $(VIRTUALENV_DIR)/bin/activate; nosetests $(NOSE_OPTS) -s -v $$component/tests/unit || exit 1; \
. $(VIRTUALENV_DIR)/bin/activate; pytest --capture=no --verbose $(PYTEST_OPTS) $$component/tests/unit || exit 1; \
done

.PHONY: runners-itests
Expand All @@ -1091,7 +1090,7 @@ runners-itests: requirements .runners-itests
echo "==========================================================="; \
echo "Running integration tests in" $$component; \
echo "==========================================================="; \
. $(VIRTUALENV_DIR)/bin/activate; nosetests $(NOSE_OPTS) -s -v $$component/tests/integration || exit 1; \
. $(VIRTUALENV_DIR)/bin/activate; pytest --capture=no --verbose $(PYTEST_OPTS) $$component/tests/integration || exit 1; \
done

.PHONY: .runners-itests-coverage-html
Expand All @@ -1104,8 +1103,8 @@ runners-itests: requirements .runners-itests
echo "==========================================================="; \
echo "Running integration tests in" $$component; \
echo "==========================================================="; \
. $(VIRTUALENV_DIR)/bin/activate; nosetests $(NOSE_OPTS) -s -v --with-coverage \
--cover-inclusive --cover-html $$component/tests/integration || exit 1; \
. $(VIRTUALENV_DIR)/bin/activate; pytest --capture=no --verbose $(PYTEST_OPTS) --cov=$$component --cov-report=html \
$$component/tests/integration || exit 1; \
done

.PHONY: cli
Expand Down Expand Up @@ -1147,7 +1146,7 @@ ci-checks: .generated-files-check .shellcheck .black-check .pre-commit-checks .f
@echo
@echo "==================== rst-check ===================="
@echo
. $(VIRTUALENV_DIR)/bin/activate; rstcheck --report warning CHANGELOG.rst
. $(VIRTUALENV_DIR)/bin/activate; rstcheck --report-level WARNING CHANGELOG.rst

.PHONY: .generated-files-check
.generated-files-check:
Expand Down
4 changes: 2 additions & 2 deletions contrib/examples/actions/ubuntu_pkg_info/ubuntu_pkg_info.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# Copyright 2020 The StackStorm Authors.
# Copyright 2020-2024 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,7 +19,7 @@
import subprocess

import six
import lib.datatransformer as transformer
import lib.datatransformer as transformer # pylint:disable=import-error,no-name-in-module


def main(args):
Expand Down
14 changes: 7 additions & 7 deletions contrib/packs/actions/pack_mgmt/get_pack_dependencies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 The StackStorm Authors.
# Copyright 2020-2024 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -125,9 +125,9 @@ def get_pack_version(pack=None):
pack_metadata = get_pack_metadata(pack_dir=pack_path)
result = pack_metadata.get("version", None)
except Exception:
result = None
finally:
return result
return None

return result


def get_dependency_list(pack=None):
Expand All @@ -138,6 +138,6 @@ def get_dependency_list(pack=None):
result = pack_metadata.get("dependencies", None)
except Exception:
print("Could not open pack.yaml at location %s" % pack_path)
result = None
finally:
return result
return None

return result
18 changes: 9 additions & 9 deletions contrib/packs/tests/test_action_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def mock_acquire(self, timeout=None):
fp.write("")

expected_msg = "Timeout waiting to acquire lock for"
self.assertRaisesRegexp(
self.assertRaisesRegex(
LockTimeout,
expected_msg,
action.run,
Expand Down Expand Up @@ -328,7 +328,7 @@ def test_run_pack_download_invalid_version(self):
"is not a valid version, hash, tag or branch.*?"
"Available versions are: 1.0.0, 2.0.0."
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
expected_msg,
action.run,
Expand All @@ -351,7 +351,7 @@ def test_download_pack_stackstorm_version_identifier_check(self):
'Pack "test3" requires StackStorm ">=1.6.0, <2.2.0", but '
'current version is "2.2.0"'
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
expected_msg,
action.run,
Expand All @@ -364,7 +364,7 @@ def test_download_pack_stackstorm_version_identifier_check(self):
'Pack "test3" requires StackStorm ">=1.6.0, <2.2.0", but '
'current version is "2.3.0"'
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
expected_msg,
action.run,
Expand All @@ -377,7 +377,7 @@ def test_download_pack_stackstorm_version_identifier_check(self):
'Pack "test3" requires StackStorm ">=1.6.0, <2.2.0", but '
'current version is "1.5.9"'
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
expected_msg,
action.run,
Expand All @@ -390,7 +390,7 @@ def test_download_pack_stackstorm_version_identifier_check(self):
'Pack "test3" requires StackStorm ">=1.6.0, <2.2.0", but '
'current version is "1.5.0"'
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
expected_msg,
action.run,
Expand Down Expand Up @@ -470,7 +470,7 @@ def test_download_pack_python_version_check(self):
r'Pack "test3" requires Python 2.x, but current Python version is '
'"3.5.2"'
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
expected_msg,
action.run,
Expand All @@ -497,7 +497,7 @@ def test_download_pack_python_version_check(self):
r'Pack "test3" requires Python 3.x, but current Python version is '
'"2.7.2"'
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
expected_msg,
action.run,
Expand Down Expand Up @@ -657,7 +657,7 @@ def test_run_pack_download_local_directory(self):

# 1. Local directory doesn't exist
expected_msg = r'Local pack directory ".*" doesn\'t exist'
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
expected_msg,
action.run,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def test_chain_runner_bad_default(self, request):
expected_msg = (
'Unable to find node with name "bad_default" referenced in "default".'
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
runnerexceptions.ActionRunnerPreRunError, expected_msg, chain_runner.pre_run
)

Expand Down Expand Up @@ -434,7 +434,7 @@ def test_chain_runner_broken_on_success_path_static_task_name(self, request):
'Unable to find node with name "c5" referenced in "on-success" '
'in task "c2"'
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
runnerexceptions.ActionRunnerPreRunError, expected_msg, chain_runner.pre_run
)

Expand All @@ -453,7 +453,7 @@ def test_chain_runner_broken_on_failure_path_static_task_name(self, request):
'Unable to find node with name "c6" referenced in "on-failure" '
'in task "c2"'
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
runnerexceptions.ActionRunnerPreRunError, expected_msg, chain_runner.pre_run
)

Expand Down Expand Up @@ -896,7 +896,7 @@ def test_chain_task_passes_invalid_parameter_type_to_action(self, mock_request):
r'Failed to cast value "stringnotanarray" \(type: str\) for parameter '
r'"arrtype" of type "array"'
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
expected_msg,
chain_runner.run,
Expand Down Expand Up @@ -944,7 +944,7 @@ def test_exception_is_thrown_if_both_params_and_parameters_attributes_are_provid
'Either "params" or "parameters" attribute needs to be provided, but '
"not both"
)
self.assertRaisesRegexp(
self.assertRaisesRegex(
runnerexceptions.ActionRunnerPreRunError, expected_msg, chain_runner.pre_run
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.

from __future__ import absolute_import
import unittest2
import unittest

import mock

Expand All @@ -24,7 +24,7 @@
from st2common.models.system.actionchain import Node


class ActionChainRunnerResolveParamsTests(unittest2.TestCase):
class ActionChainRunnerResolveParamsTests(unittest.TestCase):
def test_render_params_action_context(self):
runner = acr.get_runner()
chain_context = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_announcement_no_experimental(self, dispatch):
runner.liveaction = mock.Mock(context={})

expected_msg = "Experimental flag is missing for action some.thing"
self.assertRaisesRegexp(Exception, expected_msg, runner.pre_run)
self.assertRaisesRegex(Exception, expected_msg, runner.pre_run)

@mock.patch("st2common.models.api.trace.TraceContext.__new__")
def test_announcement_with_trace(self, context, dispatch):
Expand Down
Loading