diff --git a/.circleci/config.yml b/.circleci/config.yml index 95b4a93..88ece28 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,6 +52,8 @@ jobs: - run: name: run tox command: ~/.local/bin/tox + - store_artifacts: + path: test/artifacts - add_ssh_keys: fingerprints: - "79:16:39:74:e9:b3:39:52:87:2c:90:aa:ee:3c:09:13" diff --git a/.gitignore b/.gitignore index dd3307f..8d74172 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,6 @@ stdout* /integration* .idea/ docs/_build/ - +test/artifacts/* +!test/artifacts/.gitkeep .tox \ No newline at end of file diff --git a/test/artifacts/.gitkeep b/test/artifacts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/integration/config-linestring.geojson.json b/test/fixtures/integration/config-linestring.geojson.json index 17d8a36..b9a9026 100644 --- a/test/fixtures/integration/config-linestring.geojson.json +++ b/test/fixtures/integration/config-linestring.geojson.json @@ -8,7 +8,7 @@ {"name": "residential", "filter": ["in", "highway", "residential"]}, {"name": "unclassified", "filter": ["in", "highway", "unclassified"]} ], - "geojson": "/Users/marthamorrissey/repos/label-maker/test/fixtures/integration/labels-linestring.geojson", + "geojson": "integration-cl/labels-linestring.geojson", "imagery": "https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.jpg?access_token=ACCESS_TOKEN", "background_ratio": 1, "split_vals": [1.0, 0.0, 0.0], diff --git a/test/integration/test_classification_labels.py b/test/integration/test_classification_labels.py index 4ea1cef..89a85ce 100644 --- a/test/integration/test_classification_labels.py +++ b/test/integration/test_classification_labels.py @@ -2,6 +2,7 @@ label-maker labels --dest integration-cl --config test/fixtures/integration/config.integration.json""" import unittest import json +import os from os import makedirs from shutil import copyfile, rmtree import subprocess @@ -37,7 +38,10 @@ def test_cli(self): cmd = 'label-maker labels --dest integration-cl --config test/fixtures/integration/config.integration.json' cmd = cmd.split(' ') with subprocess.Popen(cmd, universal_newlines=True, stdout=subprocess.PIPE) as p: - self.assertEqual(expected_output, p.stdout.read()) + with open(os.path.join('test' ,'artifacts', type(self).__name__), 'w') as w: + output = p.stdout.read() + w.write(output) + self.assertEqual(expected_output, output) # our labels should look like this expected_labels = { diff --git a/test/integration/test_classification_labels_geojson.py b/test/integration/test_classification_labels_geojson.py index ef192af..aae47a8 100644 --- a/test/integration/test_classification_labels_geojson.py +++ b/test/integration/test_classification_labels_geojson.py @@ -2,6 +2,7 @@ label-maker labels --dest integration-cl --config test/fixtures/integration/config.geojson.json""" import unittest import json +import os from os import makedirs from shutil import copyfile, rmtree import subprocess @@ -37,7 +38,10 @@ def test_cli(self): cmd = 'label-maker labels --dest integration-cl --config test/fixtures/integration/config.geojson.json' cmd = cmd.split(' ') with subprocess.Popen(cmd, universal_newlines=True, stdout=subprocess.PIPE) as p: - self.assertEqual(expected_output, p.stdout.read()) + with open(os.path.join('test' ,'artifacts', type(self).__name__), 'w') as w: + output = p.stdout.read() + w.write(output) + self.assertEqual(expected_output, output) # our labels should look like this expected_labels = { diff --git a/test/integration/test_classification_labels_linestring_geojson.py b/test/integration/test_classification_labels_linestring_geojson.py index 359150d..0d4001c 100644 --- a/test/integration/test_classification_labels_linestring_geojson.py +++ b/test/integration/test_classification_labels_linestring_geojson.py @@ -2,18 +2,19 @@ label-maker labels --dest integration-cl --config test/fixtures/integration/config.geojson.json""" import unittest import json +import os from os import makedirs from shutil import copyfile, rmtree import subprocess import numpy as np -class TestClassificationLabelGeoJSON(unittest.TestCase): +class TestClassificationLabelLineStringGeoJSON(unittest.TestCase): """Tests for classification label creation""" @classmethod def setUpClass(cls): makedirs('integration-cl') - copyfile('test/fixtures/integration/labels-linestring.geojson', 'integration-cl/labels.geojson') + copyfile('test/fixtures/integration/labels-linestring.geojson', 'integration-cl/labels-linestring.geojson') @classmethod def tearDownClass(cls): @@ -37,7 +38,10 @@ def test_cli(self): cmd = 'label-maker labels --dest integration-cl --config test/fixtures/integration/config-linestring.geojson.json' cmd = cmd.split(' ') with subprocess.Popen(cmd, universal_newlines=True, stdout=subprocess.PIPE) as p: - self.assertEqual(expected_output, p.stdout.read()) + with open(os.path.join('test' ,'artifacts', type(self).__name__), 'w') as w: + output = p.stdout.read() + w.write(output) + self.assertEqual(expected_output, output) # our labels should look like this diff --git a/test/integration/test_classification_labels_sparse.py b/test/integration/test_classification_labels_sparse.py index 00ff208..d813dbd 100644 --- a/test/integration/test_classification_labels_sparse.py +++ b/test/integration/test_classification_labels_sparse.py @@ -2,6 +2,7 @@ label-maker labels --dest integration-cl --config test/fixtures/integration/config.integration_sparse.json --sparse""" import unittest import json +import os from os import makedirs from shutil import copyfile, rmtree import subprocess @@ -38,7 +39,10 @@ def test_cli(self): cmd = 'label-maker labels --dest integration-cl --config test/fixtures/integration/config.integration_sparse.json --sparse' cmd = cmd.split(' ') with subprocess.Popen(cmd, universal_newlines=True, stdout=subprocess.PIPE) as p: - self.assertEqual(expected_output, p.stdout.read()) + with open(os.path.join('test' ,'artifacts', type(self).__name__), 'w') as w: + output = p.stdout.read() + w.write(output) + self.assertEqual(expected_output, output) # our labels should look like this expected_labels = { diff --git a/test/tiles/1087767-1046604-21.jpg b/test/tiles/1087767-1046604-21.jpg new file mode 100644 index 0000000..6a6d3a1 Binary files /dev/null and b/test/tiles/1087767-1046604-21.jpg differ diff --git a/test/tiles/146-195-9.jpeg b/test/tiles/146-195-9.jpeg new file mode 100644 index 0000000..3130abb Binary files /dev/null and b/test/tiles/146-195-9.jpeg differ