diff --git a/django_iris/runner.py b/django_iris/runner.py index 251ec7e..d3dc08f 100644 --- a/django_iris/runner.py +++ b/django_iris/runner.py @@ -5,6 +5,9 @@ class IRISDiscoverRunner(DiscoverRunner): _iris_container: IRISContainer + _iris_user: str + _iris_password: str + _iris_namespace: str def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -12,15 +15,20 @@ def __init__(self, *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): @@ -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() diff --git a/requirements-dev.txt b/requirements-dev.txt index 7722b8e..679b5f8 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,3 +3,5 @@ flake8 pytest black twine +testcontainers_iris +requests<2.32.0 \ No newline at end of file diff --git a/run_tests.sh b/run_tests.sh index 8f94a4f..e14e4e0 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -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 "$@")