Skip to content

Commit

Permalink
Merge pull request #9 from EncoreTechnologies/feature/testing_updates
Browse files Browse the repository at this point in the history
Feature/testing updates
  • Loading branch information
bishopbm1 authored Aug 9, 2023
2 parents b6f5005 + c1fe308 commit e16d331
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 29 deletions.
51 changes: 31 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ PY_FILES := $(shell git ls-files '*.py')
ROOT_VIRTUALENV ?= ""

### python 2/3 specific stuff
PYTHON_EXE ?= python3

#PYTHON_EXE ?= python3
PYTHON_EXE ?= $(shell if python3.8 --version >/dev/null 2>&1; then echo "python3.8"; else echo "python3"; fi)
PYTHON_VERSION = $(shell $(PYTHON_EXE) --version 2>&1 | awk '{ print $$2 }')
PYTHON_NAME = python$(PYTHON_VERSION)
PYTHON_CI_DIR = $(ROOT_DIR)/$(PYTHON_NAME)
Expand Down Expand Up @@ -51,22 +53,22 @@ pack-name:
@echo $(PACK_NAME)

.PHONY: clean
clean: .clean-st2-repo .clean-st2-lint-repo .clean-virtualenv .clean-pack
clean: .pythonvars .clean-st2-repo .clean-st2-lint-repo .clean-virtualenv .clean-pack

.PHONY: lint
lint: virtualenv requirements .clone-st2-lint-repo flake8 pylint configs-check metadata-check
lint: .pythonvars virtualenv requirements .clone-st2-lint-repo flake8 pylint configs-check metadata-check

.PHONY: flake8
flake8: virtualenv requirements .clone-st2-lint-repo .flake8
flake8: .pythonvars virtualenv requirements .clone-st2-lint-repo .flake8

.PHONY: pylint
pylint: virtualenv requirements .clone-st2-repo .clone-st2-lint-repo .pylint
pylint: .pythonvars virtualenv requirements .clone-st2-repo .clone-st2-lint-repo .pylint

.PHONY: configs-check
configs-check: virtualenv requirements .clone-st2-repo .copy-pack-to-subdirectory .configs-check
configs-check: .pythonvars virtualenv requirements .clone-st2-repo .copy-pack-to-subdirectory .configs-check

.PHONY: metadata-check
metadata-check: virtualenv requirements .metadata-check
metadata-check: .pythonvars virtualenv requirements .metadata-check

# list all makefile targets
.PHONY: list
Expand All @@ -90,13 +92,13 @@ list:
@echo "End Time = `date --iso-8601=ns`"

.PHONY: packs-resource-register
packs-resource-register: virtualenv requirements .clone-st2-repo .copy-pack-to-subdirectory .install-mongodb .packs-resource-register
packs-resource-register: .pythonvars virtualenv requirements .clone-st2-repo .copy-pack-to-subdirectory .install-mongodb .packs-resource-register

.PHONY: packs-missing-tests
packs-missing-tests: virtualenv requirements .packs-missing-tests
packs-missing-tests: .pythonvars virtualenv requirements .packs-missing-tests

.PHONY: packs-tests
packs-tests: virtualenv requirements .clone-st2-repo .packs-tests
packs-tests: .pythonvars virtualenv requirements .clone-st2-repo .packs-tests

.PHONY: test
test: packs-tests
Expand Down Expand Up @@ -253,7 +255,13 @@ test: packs-tests
@echo
@echo "Start Time = `date --iso-8601=ns`"
. $(VIRTUALENV_DIR)/bin/activate; \
ST2_REPO_PATH=${ST2_REPO_PATH} $(ST2_REPO_PATH)/st2common/bin/st2-run-pack-tests -x -p $(PACK_DIR) || exit 1;
if [ ! -f "$(CI_DIR)/st2-requirements-installed.txt" ]; then \
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache -q -r $(ST2_REPO_PATH)/requirements.txt; \
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache -q -r $(PACK_DIR)requirements.txt; \
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache -q -r $(PACK_DIR)requirements-tests.txt; \
touch $(CI_DIR)/st2-requirements-installed.txt; \
fi; \
ST2_REPO_PATH=${ST2_REPO_PATH} $(ST2_REPO_PATH)/st2common/bin/st2-run-pack-tests -c -t -x -j -p $(PACK_DIR) || exit 1;
@echo "End Time = `date --iso-8601=ns`"

.PHONY: .packs-missing-tests
Expand Down Expand Up @@ -298,14 +306,13 @@ requirements:
@echo "==================== requirements ===================="
@echo
@echo "Start Time = `date --iso-8601=ns`"
# NOTE: pinning pip to <20.1 because new version (20.1) breaks the dist_utils.py
# that is included in most of StackStorm's code. We rely on a ParsedRequirements.link
# attribute that was removed in pip==20.1 (TODO: remove when fix is pushed everywhere)
# Reference: https://github.com/StackStorm/st2/pull/4750
. $(VIRTUALENV_DIR)/bin/activate; \
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache --upgrade "pip<20.1"; \
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache -q -r $(CI_DIR)/requirements-dev.txt; \
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache -q -r $(CI_DIR)/requirements-pack-tests.txt;
if [ ! -f "$(CI_DIR)/requirements-installed.txt" ]; then \
. $(VIRTUALENV_DIR)/bin/activate; \
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache --upgrade "pip"; \
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache -q -r $(CI_DIR)/requirements-dev.txt; \
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache -q -r $(CI_DIR)/requirements-pack-tests.txt; \
touch $(CI_DIR)/requirements-installed.txt; \
fi;
@echo "End Time = `date --iso-8601=ns`"

.PHONY: virtualenv
Expand All @@ -318,7 +325,11 @@ virtualenv:
if [ -d "$(ROOT_VIRTUALENV)" ]; then \
$(ROOT_DIR)/bin/clonevirtualenv.py $(ROOT_VIRTUALENV) $(VIRTUALENV_DIR);\
else \
python3 -m venv $(VIRTUALENV_DIR); \
if python3.8 --version >/dev/null 2>&1; then \
python3.8 -m venv $(VIRTUALENV_DIR); \
else \
python3 -m venv $(VIRTUALENV_DIR); \
fi; \
fi; \
fi;
@echo "End Time = `date --iso-8601=ns`"
Expand Down
13 changes: 7 additions & 6 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Needed for check and lint scripts
-e git+https://github.com/StackStorm/st2sdk.git@master#egg=st2sdk
-e git+https://github.com/EncoreTechnologies/st2sdk.git@feature/requirement_updates#egg=st2sdk
six==1.13.0
#flake8==4.0.1
pyyaml
pep8>=1.6.0,<1.7
pep8
flake8==3.7.7
astroid==1.6.5
pylint==1.9.4
# fix isort dependency of pylint 1.9.4 by keeping it below its 5.x version
isort>=4.2.5,<5
astroid
pylint
isort
6 changes: 3 additions & 3 deletions requirements-pack-tests.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mock>=1.3.0,<2.0
unittest2>=1.1.0,<2.0
nose>=1.3.7
mock
unittest2
nose

0 comments on commit e16d331

Please sign in to comment.