diff options
| -rw-r--r-- | example_project/local_settings.py.setup | 17 | ||||
| -rw-r--r-- | example_project/runtests.py | 41 | ||||
| -rw-r--r-- | requirements.txt | 2 | ||||
| -rw-r--r-- | setup.py | 12 | 
4 files changed, 66 insertions, 6 deletions
| diff --git a/example_project/local_settings.py.setup b/example_project/local_settings.py.setup new file mode 100644 index 000000000..54dc99c4a --- /dev/null +++ b/example_project/local_settings.py.setup @@ -0,0 +1,17 @@ +DATABASES = { +    'default': { +        'ENGINE': 'django.contrib.gis.db.backends.postgis', +        'NAME': 'ishtar-test', +        'USER': 'ishtar-test', +        'PASSWORD': 'ishtar-test', +        'HOST': '', +        'PORT': '5432', +    } +} + +LOGFILE = '/tmp/ishtar.log' + +PROJECT_SLUG = "test-instance" + +SECRET_KEY = "not-so-secret-key" +DISABLE_TASK_TIMEOUT = True diff --git a/example_project/runtests.py b/example_project/runtests.py new file mode 100644 index 000000000..633a94022 --- /dev/null +++ b/example_project/runtests.py @@ -0,0 +1,41 @@ +# run test for setup.py +import os +import shutil +import sys + +os.environ['DJANGO_SETTINGS_MODULE'] = 'example_project.settings' +test_dir = os.path.dirname(__file__) +sys.path.insert(0, test_dir) +local_settings = os.path.join(test_dir, "local_settings.py") +local_settings_exists = True +if not os.path.exists(local_settings): +    local_settings_exists = False +    shutil.copy( +        os.path.join(test_dir, "local_settings.py.setup"), +        local_settings) + +import django +from django.test.utils import get_runner +from django.conf import settings + + +def runtests(): +    django.setup() +    TestRunner = get_runner(settings) +    test_runner = TestRunner(verbosity=1, interactive=True) +    failures = test_runner.run_tests( +        ["ishtar_common.tests", +         "archaeological_files.tests", +         "archaeological_operations.tests", +         "archaeological_context_records.tests", +         "archaeological_finds.tests", +         "archaeological_warehouse.tests", +         ] +    ) +    if not local_settings_exists: +        os.remove(local_settings) +    sys.exit(failures) + + +if __name__ == '__main__': +    runtests() diff --git a/requirements.txt b/requirements.txt index 5817dc1a4..4a8034836 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ xmltodict==0.11  requests==2.21 -python-memcached==1.59 +# python-memcached==1.59  ## production  # celery==4.2.1  ## not mandatory  djangorestframework==3.9 @@ -6,6 +6,9 @@ import version  try:      reqs = open(os.path.join(os.path.dirname(__file__),                               'requirements.txt')).read() +    reqs = "\n".join( +        [r for r in reqs.split("\n") if r and not r.startswith('-e')] +    )  except (IOError, OSError):      reqs = '' @@ -17,17 +20,16 @@ setup(      long_description=open('README.rst').read(),      author=u'Étienne Loks',      author_email='etienne.loks@iggdrasil.net', -    url='http://ishtar-archeo.net/', +    url='https://ishtar-archeo.net/',      license='AGPL v3 licence, see COPYING',      packages=[          'archaeological_finds', 'example_project',          'archaeological_warehouse', 'archaeological_files_pdl', -        'archaeological_files', 'simple_history', 'ishtar_common', -        'archaeological_operations', 'archaeological_context_records', -        'ishtar_pdl'], +        'archaeological_files', 'ishtar_common', +        'archaeological_operations', 'archaeological_context_records'],      include_package_data=True,      install_requires=reqs, -    # test_suite = "", +    test_suite="example_project.runtests.runtests",      classifiers=[          'Development Status :: 5 - Production/Stable',          'Environment :: Web Environment', | 
