Repository: Workday/prism-python

Issue:
Add PyTest
Add a simple unit test to make sure the package successfully imports. Unit tests can be expanded in the future to offer greater coverage. 

Discussion:

Patch:
diff --git a/.travis.yml b/.travis.yml
index 4da15ef..478c235 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,4 +7,4 @@ python:
 install:
   - pip install .
 script:
-- echo "skipping tests"
+- pytest
diff --git a/environment.yml b/environment.yml
index de104b0..9049cf6 100644
--- a/environment.yml
+++ b/environment.yml
@@ -4,3 +4,4 @@ channels:
 dependencies:
   - python=3.7
   - requests
+  - pytest
diff --git a/prism/data/schema.json b/prism/data/schema.json
new file mode 100644
index 0000000..896c055
--- /dev/null
+++ b/prism/data/schema.json
@@ -0,0 +1,42 @@
+{
+    "fields": [
+        {
+            "defaultValue": "textField",
+            "description": "this is a Text Field",
+            "name": "State2",
+            "parseFormat": "",
+            "precision": 0,
+            "ordinal": 1,
+            "scale": 0,
+            "type": {
+                "id": "Schema_Field_Type=Text"
+            }
+        },
+        {
+            "defaultValue": "0",
+            "description": "this is an Integer Field",
+            "name": "Population2",
+            "parseFormat": "",
+            "precision": 9,
+            "ordinal": 2,
+            "scale": 0,
+            "type": {
+                "id": "Schema_Field_Type=Numeric"
+            }
+        }
+    ],
+    "parseOptions": {
+        "charset": {
+            "id": "Encoding=UTF-8"
+        },
+        "fieldsDelimitedBy": ",",
+        "fieldsEnclosedBy": "\"",
+        "headerLinesToIgnore": 1,
+        "type": {
+            "id": "Schema_File_Type=Delimited"
+        }
+    },
+    "schemaVersion": {
+        "id": "Schema_Version=1.0"
+    }
+}
\ No newline at end of file
diff --git a/setup.py b/setup.py
index f8e5ce8..5ea16f2 100644
--- a/setup.py
+++ b/setup.py
@@ -13,7 +13,13 @@ setup(
     author_email='CurtLHampton@gmail.com',
     url='https://github.com/Workday/prism-python',
     packages=['prism'],
+    package_data={'prism': ['data/*']},
     install_requires=requirements,
+    extras_require={
+        'dev': [
+            'pytest',
+        ]
+    },
     keywords='prism',
     classifiers=[
         'Programming Language :: Python :: 3.6',


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 0000000..317f19d
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,11 @@
+import os
+import pytest
+
+@pytest.fixture
+def rootdir():
+    return os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
+
+@pytest.fixture
+def schema_file(rootdir):
+    """Path to example JSON schema"""
+    return os.path.join(rootdir, 'prism', 'data', 'schema.json')
diff --git a/tests/test_prism.py b/tests/test_prism.py
new file mode 100644
index 0000000..bfaad2f
--- /dev/null
+++ b/tests/test_prism.py
@@ -0,0 +1,5 @@
+import prism
+
+def test_load_schema(schema_file):
+    schema = prism.load_schema(schema_file)
+    assert type(schema) is dict