Skip to content

Commit 1dadce4

Browse files
committed
mark matplotlib tests, add requirements.txt
1 parent 0be2da1 commit 1dadce4

7 files changed

Lines changed: 30 additions & 4 deletions

File tree

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ language: python
33
python:
44
- "3.5"
55

6+
before_install:
7+
- pip install -e .
8+
- "git clone https://$GH_TOKEN@github.com/datacamp/pythonbackend.git && pip install ./pythonbackend && rm -rf pythonbackend"
69
install: pip install -r requirements.txt
710

8-
script: python tests/run_all.py
11+
script: pytest tests -m "not dep_matplotlib" -s

requirements.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
dill
2+
markdown2
3+
numpy
4+
pandas
5+
matplotlib
6+
boto3
7+
bs4
8+
h5py
9+
10+
sqlalchemy
11+
requests
12+
xlrd
13+
tweepy
14+
scipy
15+
sas7bdat

tests/helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import re
44

55
def get_sct_payload(output):
6-
output = [out for out in output if out['type'] == 'sct']
7-
if (len(output) > 0):
8-
return(output[0]['payload'])
6+
sct_output = [out for out in output if out['type'] == 'sct']
7+
if (len(sct_output) > 0):
8+
return(sct_output[0]['payload'])
99
else:
1010
print(output)
1111
return(None)

tests/test_content.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import unittest
22
import helper
3+
import pytest
34

5+
@pytest.mark.dep_matplotlib
46
class TestTemplate(unittest.TestCase):
57
def setUp(self):
68
self.data = {

tests/test_test_function_v2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
22
import helper
3+
import pytest
34

45
class TestFunctionBase(unittest.TestCase):
56

@@ -955,6 +956,7 @@ def test_pandas(self):
955956
self.assertFalse(sct_payload['correct'])
956957
self.assertIn("Did you call <code>pad.DataFrame()</code> with the correct arguments?", sct_payload['message'])
957958

959+
@pytest.mark.dep_matplotlib
958960
def test_mpl(self):
959961
self.data = {
960962
"DC_PEC": "",

tests/test_test_importing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
22
import helper
3+
import pytest
34

45
class TestExercise1(unittest.TestCase):
56

@@ -536,6 +537,7 @@ def test_for_body():
536537
self.assertTrue(sct_payload['correct'])
537538

538539

540+
@pytest.mark.dep_matplotlib
539541
class TestImportWhenTestFunction(unittest.TestCase):
540542

541543
def test_pass(self):

tests/test_test_with.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
22
import helper
3+
import pytest
34

45
class TestExercise1(unittest.TestCase):
56

@@ -307,6 +308,7 @@ def test_Pass1_no_lam(self):
307308
sct_payload = helper.run(self.data)
308309
self.assertTrue(sct_payload['correct'])
309310

311+
@pytest.mark.dep_matplotlib
310312
class TestExercise5(unittest.TestCase):
311313

312314
def setUp(self):

0 commit comments

Comments
 (0)