Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 2 deletions .github/workflows/lint-and-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down
37 changes: 27 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ VIRTUALENV_DIR ?= virtualenv

ST2_REPO_PATH ?= /tmp/st2
ST2_REPO_BRANCH ?= master
PYBIN := python3

PIP_OPTIONS := $(ST2_PIP_OPTIONS)

Expand All @@ -44,27 +45,43 @@ play:
@echo "`cat /etc/os-release`"
@echo

.PHONY: clean
clean:
@echo
@echo "==================== clean cache files and virtualenv ===================="
@echo
rm -rf ./.pytest_cache ./virtualenv ./st2_auth_ldap.egg-info
find . -iname '*.pyc' -delete
find . -iname '__pycache__' -delete

.PHONY: requirements
requirements: .clone_st2_repo virtualenv
@echo
@echo "==================== requirements ===================="
@echo
$(eval PIP_VERSION := $(shell grep 'PIP_VERSION ?= ' /tmp/st2/Makefile | awk '{ print $$3}'))
$(VIRTUALENV_DIR)/bin/pip install --upgrade "pip==$(PIP_VERSION)"
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r $(ST2_REPO_PATH)/requirements.txt
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r $(ST2_REPO_PATH)/test-requirements.txt
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r requirements.txt
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r test-requirements.txt
$(eval PIP_VERSION ?= $(shell awk '/^PIP_VERSION/ {print $$3}' /tmp/st2/Makefile))
$(eval SETUPTOOLS_VERSION ?= $(shell awk '/^SETUPTOOLS_VERSION/ {print $$3}' /tmp/st2/Makefile))
@echo
@echo
@echo Install pip $(PIP_VERSION) and setuptools $(SETUPTOOLS_VERSION) to match st2 core.
@echo
@echo
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --upgrade "pip==$(PIP_VERSION)"
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --upgrade "setuptools==$(SETUPTOOLS_VERSION)"
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r $(ST2_REPO_PATH)/requirements.txt
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r $(ST2_REPO_PATH)/test-requirements.txt
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r requirements.txt
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r test-requirements.txt

@echo ""
@echo "================== register st2auth ======================"
@echo ""
# Install st2auth
(. $(VIRTUALENV_DIR)/bin/activate; cd $(ST2_REPO_PATH)/st2auth; python3 setup.py develop --no-deps)
(. $(VIRTUALENV_DIR)/bin/activate; cd $(ST2_REPO_PATH)/st2auth; $(PYBIN) -m pip install --no-deps --editable .)
@echo ""
@echo "================== register ldap ======================"
@echo ""
(. $(VIRTUALENV_DIR)/bin/activate; python3 setup.py develop --no-deps)
(. $(VIRTUALENV_DIR)/bin/activate; $(PYBIN) -m pip install --no-deps --editable .)

.PHONY: requirements-ci

Expand All @@ -74,7 +91,7 @@ $(VIRTUALENV_DIR)/bin/activate:
@echo
@echo "==================== virtualenv ===================="
@echo
test -d $(VIRTUALENV_DIR) || virtualenv $(VIRTUALENV_DIR) -p python3
test -d $(VIRTUALENV_DIR) || $(PYBIN) -m venv $(VIRTUALENV_DIR)

# Setup PYTHONPATH in bash activate script...
# Delete existing entries (if any)
Expand Down Expand Up @@ -126,7 +143,7 @@ unit-tests: requirements .clone_st2_repo .unit-tests
.PHONY: .clone_st2_repo
.clone_st2_repo:
@echo
@echo "==================== cloning st2 repo ===================="
@echo "==================== cloning st2 repo [$(ST2_REPO_BRANCH)] ===================="
@echo
@rm -rf /tmp/st2
@git clone https://github.com/StackStorm/st2.git --depth 1 --single-branch --branch $(ST2_REPO_BRANCH) /tmp/st2
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ python-ldap>=3.4.0,<3.5.0
# - 3.1 adds python3.8
# - 4.2 adds python3.9
# - 5.2.1 adds python3.11
cachetools>=3.1,<5.4.0
cachetools<5.4.0,>=3.1
2 changes: 1 addition & 1 deletion tests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def test_client_options(self):
def test_invalid_group_dns_check_option(self):
expected_msg = ('Invalid value "invalid" for group_dns_check option. Valid '
'values are: and, or.')
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
expected_msg,
ldap_backend.LDAPAuthenticationBackend,
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38,py39,py310,py311,lint
envlist = py310,py311,py312,lint

[testenv]
deps = -r{toxinidir}/requirements.txt
Expand Down
Loading