Skip to content

Commit

Permalink
run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daimor committed May 21, 2024
1 parent e2a8afa commit a45a922
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
18 changes: 14 additions & 4 deletions django_iris/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@

class IRISDiscoverRunner(DiscoverRunner):
_iris_container: IRISContainer
_iris_user: str
_iris_password: str
_iris_namespace: str

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

iris_image = getattr(
settings, "IRIS_IMAGE", "intersystemsdc/iris-community:latest"
)
iris_user = getattr(settings, "IRIS_USERNAME", "_SYSTEM")
iris_password = getattr(settings, "IRIS_PASSWORD", "SYS")
iris_key = getattr(settings, "IRIS_KEY", None)
self._iris_user = getattr(settings, "IRIS_USERNAME", "DJANGO")
self._iris_password = getattr(settings, "IRIS_PASSWORD", "django")
iris_name = getattr(settings, "IRIS_NAMESPACE", "USER")
extra = {}
if iris_key:
extra["license_key"] = iris_key

self._iris_container = IRISContainer(
image=iris_image,
username=iris_user,
password=iris_password,
username=self._iris_user,
password=self._iris_password,
namespace=iris_name,
**extra
)

def _setup_container(self):
Expand All @@ -35,6 +43,8 @@ def _setup_container(self):
settings.DATABASES[database]["PORT"] = int(
self._iris_container.get_exposed_port(1972)
)
settings.DATABASES[database]["USER"] = self._iris_user
settings.DATABASES[database]["PASSWORD"] = self._iris_password

def _teardown_container(self):
self._iris_container.stop()
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ flake8
pytest
black
twine
testcontainers_iris
requests<2.32.0
7 changes: 6 additions & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

export PYTHONPATH=$(pwd):../intersystems-irispython:.
# python -m venv .venv
# source .venv/bin/activate
# pip install ../django -r requirements.txt -r requirements-dev.txt -e .

export PYTHONPATH=.:$(pwd)
# export PYTHONPATH=.:$(pwd):../intersystems-irispython
(cd ../django && python tests/runtests.py --settings=iris_settings --noinput "$@")

0 comments on commit a45a922

Please sign in to comment.