Skip to content

Commit

Permalink
use pytest and add pytest.ini file
Browse files Browse the repository at this point in the history
  • Loading branch information
jmath1 committed Nov 6, 2020
1 parent 6bd4ecb commit 778ee21
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
4 changes: 1 addition & 3 deletions config/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ django-compress==1.0.1
django-cors-middleware==1.3.1
django-extensions==2.2.9
django-mailgun==0.9.1
django-nose==1.4.7
django-oauth-toolkit==1.2.0
django-qurl==0.1.1
django-paypal==1.0
Expand All @@ -35,8 +34,6 @@ mongoengine==0.20.0
PyMySQL==0.9.3
ndg-httpsclient==0.4.2
nltk==3.4.5
nose==1.3.7
nose-exclude==0.5.0
numpy==1.18.5
oauth2==1.9.0.post1
pillow==7.0.0
Expand All @@ -48,6 +45,7 @@ pyflakes==1.3.0
pymongo==3.4.0
pymysql==0.9.3
pyopenssl>=17.5.0
pytest==6.1.2
python-dateutil==2.6.0
python-digitalocean==1.13.2
python-gflags==3.1.0
Expand Down
3 changes: 1 addition & 2 deletions newsblur_web/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
LOGGING_LOG_SQL = True
APPEND_SLASH = False
SESSION_ENGINE = 'redis_sessions.session'
TEST_RUNNER = "django_nose.NoseTestSuiteRunner"
TEST_RUNNER = "utils.testrunner.TestRunner"
SESSION_COOKIE_NAME = 'newsblur_sessionid'
SESSION_COOKIE_AGE = 60*60*24*365*10 # 10 years
SESSION_COOKIE_DOMAIN = '.newsblur.com'
Expand Down Expand Up @@ -338,7 +338,6 @@
'vendor.zebra',
'oauth2_provider',
'corsheaders',
'django_nose',
)

# ==========
Expand Down
25 changes: 15 additions & 10 deletions newsblur_web/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

DOCKERBUILD = os.getenv("DOCKERBUILD")

if 'test' in sys.argv:
DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
DATABASES['default']['OPTIONS'] = {}
DATABASES['default']['NAME'] = 'nb.db'
DATABASES['default']['TEST_NAME'] = 'nb2.db'
DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
DATABASES['default']['OPTIONS'] = {}
DATABASES['default']['NAME'] = 'nb.db'
DATABASES['default']['TEST_NAME'] = 'nb2.db'

# DATABASES = {
# 'default':{
Expand All @@ -18,13 +17,18 @@
# }
if DOCKERBUILD:
MONGO_PORT = 29019
MONGO_DB = {
'name': 'newsblur_test',
'host': '127.0.0.1:29019',
}

else:
MONGO_PORT = 27017

MONGO_DB = {
'name': 'newsblur_test',
'host': '127.0.0.1:29019',
}
MONGO_DB = {
'name': 'newsblur_test',
'host': '127.0.0.1:27017',
}
SERVER_NAME

MONGO_DATABASE_NAME = 'test_newsblur'
# TEST_DATABASE_NAME = ":memory:"
Expand All @@ -36,6 +40,7 @@
SITE_ID = 2
RAVEN_CLIENT = None
HOMEPAGE_USERNAME = 'conesus'
SERVER_NAME = 'test_newsblur'
# from django.db import connection
# cursor = connection.cursor()
# cursor.execute('PRAGMA temp_store = MEMORY;')
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
DJANGO_SETTINGS_MODULE = newsblur_web.test_settings

0 comments on commit 778ee21

Please sign in to comment.