-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Omnibus PR for our consideration 2019.10.04 #746
Changes from 40 commits
ab842c7
7f7ee7e
72cd357
cbc2fe8
f29bb12
56fedca
899801e
5e9c908
776da7a
782c932
5f08c5e
0fcb003
8b48bd5
30f5318
cbe3f35
2094d89
ede8656
fe5d454
69b68d2
f64cfc4
065213e
70da5bd
dc87af3
793fded
0f35377
db9b170
9634fbe
afe5a85
2b14c1d
85e241c
4daa837
bcd62f3
3e1867c
5ccbf39
3735b9f
d035927
fed8503
8db5bb2
21b4e7e
969c8f2
1dd9435
858c917
cc1f14b
1fa5444
e586c26
12a9564
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[[source]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. General approach for setting up Pipfile is to set minimum versions but not fix any versions unless necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK! |
||
name = "pypi" | ||
verify_ssl = true | ||
url = "https://pypi.org/simple" | ||
|
||
[packages] | ||
anyjson = ">=0.3.3" | ||
coverage = ">=4.0.3" | ||
coveralls = ">=1.1" | ||
Django = ">=2.0.7" | ||
django-debug-toolbar = ">=1.9" | ||
django-redis-cache = ">=1.7.0" | ||
django-reversion = ">=2.0.6" | ||
django-user_agents = ">=0.3.0" | ||
docopt = ">=0.6.2" | ||
feedparser = ">=5.2.1" | ||
geojson = ">=1.3" | ||
isodate = ">=0.5.4" | ||
jsonfield = ">=1.0.3" | ||
lxml = ">=3.8" | ||
mysolr = ">=0.8.3" | ||
numpy = ">=1.11.0" | ||
pandas = ">=0.24.0" | ||
"psycopg2" = ">=2.7.5" | ||
pyparsing = ">=2.1.1" | ||
python-dateutil = ">=2.5.3" | ||
pytz = ">=2016.4" | ||
rdflib = ">=4.2.1" | ||
rdflib-jsonld = ">=0.4.0" | ||
redis = ">=2.10.5" | ||
requests = ">=2.20.0" | ||
roman = ">=2.0.0" | ||
scipy = ">=0.17.0" | ||
six = ">=1.10.0" | ||
sqlparse = ">=0.2.4" | ||
titlecase = ">=0.9.0" | ||
ua-parser = ">=0.7.1" | ||
user-agents = ">=1.0.1" | ||
python-memcached = ">=1.59" | ||
pyproj = ">=1.9.5" | ||
atomicwrites = ">=1.2.1" | ||
attrs = ">=18.2.0" | ||
more-itertools = ">=4.3.0" | ||
"pathlib2" = ">=2.3.2" | ||
pluggy = ">=0.8.0" | ||
py = ">=1.7.0" | ||
pytest = ">=3.9.3" | ||
pytest-django = ">=3.4.3" | ||
Pillow = ">=5.2.0" | ||
PyYAML = ">=3.11" | ||
Shapely = ">=1.5.15" | ||
Unidecode = ">=0.4.19" | ||
uWSGI = ">=2.0.17.1" | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.7" |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file enables the use of production database for tests. One thing that needs to confirmed: is this the right place for this file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. I can look into this also. We should mainly just configure database access for tests that go in the tests/regression path. The "unit" tests should be completely database free, and the "integration" tests can use a short term database that gets temporarily set up and then torn down after the tests complete. |
||
import json | ||
from opencontext_py import settings | ||
|
||
@pytest.fixture(autouse=True) | ||
def enable_db_access_for_all_tests(db): | ||
pass | ||
|
||
@pytest.fixture(scope='session') | ||
def django_db_setup(): | ||
|
||
with open('secrets.json', 'r') as secrets_file: | ||
secrets = json.loads(secrets_file.read()) | ||
|
||
settings.DATABASES['default'] = { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
'NAME': secrets.get('DATABASES_NAME'), | ||
'USER': secrets.get('DATABASES_USER'), | ||
'PASSWORD': secrets.get('DATABASES_PASSWORD'), | ||
'HOST': secrets.get('DATABASES_HOST'), | ||
'CONN_MAX_AGE': 600, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
from django.db import transaction | ||
from django.conf import settings | ||
from django.test import TestCase | ||
from django.test.client import Client | ||
from rdflib.plugin import register, Parser | ||
from rdflib import Graph, URIRef, Literal | ||
from rdflib.graph import ConjunctiveGraph | ||
|
@@ -28,10 +29,15 @@ def setUp(self): | |
'rdflib_jsonld.parser', | ||
'JsonLDParser') | ||
# self.graph = Graph() | ||
self.proj_context_uri = 'http://127.0.0.1:8000/contexts/projects/3.json' | ||
# self.proj_context_uri = 'http://127.0.0.1:8000/contexts/projects/3FAAA477-5572-4B05-8DC1-CA264FE1FC10.json' | ||
self.proj_context_uri = '/contexts/projects/3FAAA477-5572-4B05-8DC1-CA264FE1FC10.json' | ||
self.context_file = settings.STATIC_IMPORTS_ROOT + '3-context.json' | ||
self.data_file = settings.STATIC_IMPORTS_ROOT + 'dt-bone.json' | ||
self.context_str = self.request_json_str(self.proj_context_uri) | ||
#self.context_str = self.request_json_str(self.proj_context_uri) | ||
client = Client() | ||
response = client.get(self.proj_context_uri, follow=True) | ||
assert response.status_code in [200,301] | ||
self.context_str = response.content | ||
self.data_str = self.load_json_file_str(self.data_file) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. at this point, the setup still fails because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to check in dt-bone.json into the STATIC_IMPORTS_ROOT dir? Is there a complication to this? |
||
g_context = ConjunctiveGraph(identifier=self.proj_context_uri) | ||
g_context.parse(data=self.context_str, format='json-ld') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# About Tests | ||
|
||
The tests directory should be subdivided into 3 directories with different kinds of tests. This will be: | ||
|
||
1. `/unit`: These will test functions and not require use of the database. | ||
2. `/integration`: These are tests need a (temporary) database, but can work with fake data. | ||
3. `/regression`: These tests will either require or will be easiest to conduct with real data in the Open Context database. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to encrypt open-context-py/referral-spam.conf at ry20191004 · rdhyee/open-context-py -- hence this line to help understand diffs in that file