diff --git a/.travis.yml b/.travis.yml index cab094db..1a05cc8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,24 +8,21 @@ cache: - npm install: - set -eo pipefail - - pip install yapf flake8 - - make pydist - - make install-dist - - pip install -r server/requirements-dev.txt + - pip install flake8 + - make pydist install-dist dev-env jobs: include: - name: "Branch Tests 3.7" python: "3.7" - script: ./travis-build.sh + script: make build-client lint unit-test - name: "Branch Tests 3.6" python: "3.6" - script: ./travis-build.sh + script: make build-client lint unit-test - name: "Docker Build" install: skip python: "3.6" script: docker build . - name: "Smoke Tests" python: "3.6" - script: - - npm run --prefix client/ smoke-test + script: make smoke-test diff --git a/Makefile b/Makefile index 94bf2961..6a770db1 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,17 @@ build-for-server-dev: clean-server build-client cp client/build/service-worker.js server/app/web/static/js/ +# TESTING +.PHONY: unit-test +unit-test: unit-test-server unit-test-client + +unit-test-%: + cd $(*) && $(MAKE) unit-test + +.PHONY: smoke-test +smoke-test: + cd client && $(MAKE) smoke-test + # FORMATTING CODE .PHOHY: fmt diff --git a/client/Makefile b/client/Makefile index ed6ae93e..53a63db8 100644 --- a/client/Makefile +++ b/client/Makefile @@ -14,3 +14,10 @@ fmt: clean: rm -rf node_modules +.PHONY: unit-test +unit-test: + npm run unit-test + +.PHONY: smoke-test +smoke-test: + npm run smoke-test diff --git a/server/Makefile b/server/Makefile index ae9bbd36..67d7b1d8 100644 --- a/server/Makefile +++ b/server/Makefile @@ -10,3 +10,7 @@ lint: clean: rm -f app/web/templates/index.html rm -rf app/web/static + +.PHONY: unit-test +unit-test: + pytest -s test diff --git a/server/test/test_api.py b/server/test/test_api.py index 7f396431..b2c581aa 100644 --- a/server/test/test_api.py +++ b/server/test/test_api.py @@ -19,7 +19,7 @@ class EndPoints(unittest.TestCase): @classmethod def setUpClass(cls): - cls.ps = Popen(["cellxgene", "launch", "example-dataset/pbmc3k.h5ad", "--verbose", "--port", "5005"]) + cls.ps = Popen(["cellxgene", "launch", "../example-dataset/pbmc3k.h5ad", "--verbose", "--port", "5005"]) session = requests.Session() for i in range(90): try: diff --git a/server/test/test_nan_rest.py b/server/test/test_nan_rest.py index a9ba4dd7..45895811 100644 --- a/server/test/test_nan_rest.py +++ b/server/test/test_nan_rest.py @@ -21,7 +21,7 @@ class WithNaNs(unittest.TestCase): @classmethod def setUpClass(cls): cls.ps = Popen( - ["cellxgene", "launch", "server/test/test_datasets/nan.h5ad", "--verbose", "--port", "5006"] + ["cellxgene", "launch", "test/test_datasets/nan.h5ad", "--verbose", "--port", "5006"] ) session = requests.Session() for i in range(90): diff --git a/server/test/test_nan_scanpy_engine.py b/server/test/test_nan_scanpy_engine.py index ec85d2aa..7c193f55 100644 --- a/server/test/test_nan_scanpy_engine.py +++ b/server/test/test_nan_scanpy_engine.py @@ -21,12 +21,12 @@ class NaNTest(unittest.TestCase): } with warnings.catch_warnings(): warnings.simplefilter("ignore", category=UserWarning) - self.data = ScanpyEngine(DataLocator("server/test/test_datasets/nan.h5ad"), self.args) + self.data = ScanpyEngine(DataLocator("test/test_datasets/nan.h5ad"), self.args) self.data._create_schema() def test_load(self): with self.assertWarns(UserWarning): - ScanpyEngine(DataLocator("server/test/test_datasets/nan.h5ad"), self.args) + ScanpyEngine(DataLocator("test/test_datasets/nan.h5ad"), self.args) def test_init(self): self.assertEqual(self.data.cell_count, 100) diff --git a/server/test/test_scanpy_engine.py b/server/test/test_scanpy_engine.py index 73ed8de0..bf81d125 100644 --- a/server/test/test_scanpy_engine.py +++ b/server/test/test_scanpy_engine.py @@ -19,13 +19,13 @@ Test the scanpy engine using the pbmc3k data set. @parameterized_class(("data_locator", "backed"), [ - ("example-dataset/pbmc3k.h5ad", False), - ("server/test/test_datasets/pbmc3k-CSC-gz.h5ad", False), - ("server/test/test_datasets/pbmc3k-CSR-gz.h5ad", False), + ("../example-dataset/pbmc3k.h5ad", False), + ("test/test_datasets/pbmc3k-CSC-gz.h5ad", False), + ("test/test_datasets/pbmc3k-CSR-gz.h5ad", False), - ("example-dataset/pbmc3k.h5ad", True), - ("server/test/test_datasets/pbmc3k-CSC-gz.h5ad", True), - ("server/test/test_datasets/pbmc3k-CSR-gz.h5ad", True), + ("../example-dataset/pbmc3k.h5ad", True), + ("test/test_datasets/pbmc3k-CSC-gz.h5ad", True), + ("test/test_datasets/pbmc3k-CSR-gz.h5ad", True), ]) class EngineTest(unittest.TestCase): def setUp(self): diff --git a/server/test/test_scanpy_engine_data_load.py b/server/test/test_scanpy_engine_data_load.py index 2be0b400..0d03b070 100644 --- a/server/test/test_scanpy_engine_data_load.py +++ b/server/test/test_scanpy_engine_data_load.py @@ -11,7 +11,7 @@ class DataLoadEngineTest(unittest.TestCase): Test file loading, including deferred loading/update. """ def setUp(self): - self.data_file = DataLocator("example-dataset/pbmc3k.h5ad") + self.data_file = DataLocator("../example-dataset/pbmc3k.h5ad") self.data = ScanpyEngine() def test_init(self): @@ -76,7 +76,7 @@ class DataLocatorEngineTest(unittest.TestCase): self.assertEqual(data.gene_count, 1838) def test_posix_file(self): - locator = DataLocator("example-dataset/pbmc3k.h5ad") + locator = DataLocator("../example-dataset/pbmc3k.h5ad") data = ScanpyEngine(locator, self.args) self.stdAsserts(data) diff --git a/server/test/test_writable_annotation.py b/server/test/test_writable_annotation.py index 5df57f1c..f63e8304 100644 --- a/server/test/test_writable_annotation.py +++ b/server/test/test_writable_annotation.py @@ -27,7 +27,7 @@ class WritableAnnotationTest(unittest.TestCase): "annotations_file": self.annotations_file, "annotations_output_dir": None } - self.data = ScanpyEngine(DataLocator("example-dataset/pbmc3k.h5ad"), args) + self.data = ScanpyEngine(DataLocator("../example-dataset/pbmc3k.h5ad"), args) def tearDown(self): shutil.rmtree(self.tmpDir) diff --git a/travis-build.sh b/travis-build.sh deleted file mode 100755 index ec8a64c7..00000000 --- a/travis-build.sh +++ /dev/null @@ -1,5 +0,0 @@ -set -eo pipefail -make lint -npm run --prefix client/ build -npm run --prefix client/ unit-test -pytest -s server/test