Skip to content

Commit a45a922

Browse files
committed
run tests
1 parent e2a8afa commit a45a922

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

django_iris/runner.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,30 @@
55

66
class IRISDiscoverRunner(DiscoverRunner):
77
_iris_container: IRISContainer
8+
_iris_user: str
9+
_iris_password: str
10+
_iris_namespace: str
811

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

1215
iris_image = getattr(
1316
settings, "IRIS_IMAGE", "intersystemsdc/iris-community:latest"
1417
)
15-
iris_user = getattr(settings, "IRIS_USERNAME", "_SYSTEM")
16-
iris_password = getattr(settings, "IRIS_PASSWORD", "SYS")
18+
iris_key = getattr(settings, "IRIS_KEY", None)
19+
self._iris_user = getattr(settings, "IRIS_USERNAME", "DJANGO")
20+
self._iris_password = getattr(settings, "IRIS_PASSWORD", "django")
1721
iris_name = getattr(settings, "IRIS_NAMESPACE", "USER")
22+
extra = {}
23+
if iris_key:
24+
extra["license_key"] = iris_key
1825

1926
self._iris_container = IRISContainer(
2027
image=iris_image,
21-
username=iris_user,
22-
password=iris_password,
28+
username=self._iris_user,
29+
password=self._iris_password,
2330
namespace=iris_name,
31+
**extra
2432
)
2533

2634
def _setup_container(self):
@@ -35,6 +43,8 @@ def _setup_container(self):
3543
settings.DATABASES[database]["PORT"] = int(
3644
self._iris_container.get_exposed_port(1972)
3745
)
46+
settings.DATABASES[database]["USER"] = self._iris_user
47+
settings.DATABASES[database]["PASSWORD"] = self._iris_password
3848

3949
def _teardown_container(self):
4050
self._iris_container.stop()

requirements-dev.txt

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ flake8
33
pytest
44
black
55
twine
6+
testcontainers_iris
7+
requests<2.32.0

run_tests.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/bin/bash
22

3-
export PYTHONPATH=$(pwd):../intersystems-irispython:.
3+
# python -m venv .venv
4+
# source .venv/bin/activate
5+
# pip install ../django -r requirements.txt -r requirements-dev.txt -e .
6+
7+
export PYTHONPATH=.:$(pwd)
8+
# export PYTHONPATH=.:$(pwd):../intersystems-irispython
49
(cd ../django && python tests/runtests.py --settings=iris_settings --noinput "$@")
510

0 commit comments

Comments
 (0)