You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2022/12/08 17:37:37 UTC

[airavata-django-portal-sdk] 01/03: Switch to pytest for running unit tests

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal-sdk.git

commit 5619f467925111e69f1d846b39c418127a52c08e
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Dec 8 10:42:23 2022 -0500

    Switch to pytest for running unit tests
---
 README.md            |  2 +-
 pytest.ini           |  2 ++
 requirements-dev.txt |  2 ++
 runtests.py          | 15 ---------------
 4 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/README.md b/README.md
index 1858e1b..f203190 100644
--- a/README.md
+++ b/README.md
@@ -61,7 +61,7 @@ pip install -r requirements-dev.txt
 ### Running tests
 
 ```
-./runtests.py
+pytest
 ```
 
 or
diff --git a/pytest.ini b/pytest.ini
new file mode 100644
index 0000000..2d475e6
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1,2 @@
+[pytest]
+DJANGO_SETTINGS_MODULE = airavata_django_portal_sdk.tests.test_settings
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 3575022..7481b0e 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -7,3 +7,5 @@ mkdocs==1.3.0
 mkautodoc==0.1.0
 pycodestyle==2.6.0
 Jinja2==3.0.3
+pytest==7.2.0
+pytest-django==4.5.2
diff --git a/runtests.py b/runtests.py
deleted file mode 100755
index 8a9cf7c..0000000
--- a/runtests.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env python
-import os
-import sys
-
-import django
-from django.conf import settings
-from django.test.utils import get_runner
-
-if __name__ == "__main__":
-    os.environ['DJANGO_SETTINGS_MODULE'] = 'airavata_django_portal_sdk.tests.test_settings'
-    django.setup()
-    TestRunner = get_runner(settings)
-    test_runner = TestRunner()
-    failures = test_runner.run_tests(["airavata_django_portal_sdk.tests"])
-    sys.exit(bool(failures))