Add a root test target that calls sub-tests

This commit is contained in:
Matt Weiden
2019-12-19 15:20:41 -08:00
parent 1eef44d5f8
commit 9a0f7c3179
11 changed files with 40 additions and 26 deletions
+5 -8
View File
@@ -8,24 +8,21 @@ cache:
- npm - npm
install: install:
- set -eo pipefail - set -eo pipefail
- pip install yapf flake8 - pip install flake8
- make pydist - make pydist install-dist dev-env
- make install-dist
- pip install -r server/requirements-dev.txt
jobs: jobs:
include: include:
- name: "Branch Tests 3.7" - name: "Branch Tests 3.7"
python: "3.7" python: "3.7"
script: ./travis-build.sh script: make build-client lint unit-test
- name: "Branch Tests 3.6" - name: "Branch Tests 3.6"
python: "3.6" python: "3.6"
script: ./travis-build.sh script: make build-client lint unit-test
- name: "Docker Build" - name: "Docker Build"
install: skip install: skip
python: "3.6" python: "3.6"
script: docker build . script: docker build .
- name: "Smoke Tests" - name: "Smoke Tests"
python: "3.6" python: "3.6"
script: script: make smoke-test
- npm run --prefix client/ smoke-test
+11
View File
@@ -54,6 +54,17 @@ build-for-server-dev: clean-server build-client
cp client/build/service-worker.js server/app/web/static/js/ 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 # FORMATTING CODE
.PHOHY: fmt .PHOHY: fmt
+7
View File
@@ -14,3 +14,10 @@ fmt:
clean: clean:
rm -rf node_modules rm -rf node_modules
.PHONY: unit-test
unit-test:
npm run unit-test
.PHONY: smoke-test
smoke-test:
npm run smoke-test
+4
View File
@@ -10,3 +10,7 @@ lint:
clean: clean:
rm -f app/web/templates/index.html rm -f app/web/templates/index.html
rm -rf app/web/static rm -rf app/web/static
.PHONY: unit-test
unit-test:
pytest -s test
+1 -1
View File
@@ -19,7 +19,7 @@ class EndPoints(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): 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() session = requests.Session()
for i in range(90): for i in range(90):
try: try:
+1 -1
View File
@@ -21,7 +21,7 @@ class WithNaNs(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
cls.ps = Popen( 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() session = requests.Session()
for i in range(90): for i in range(90):
+2 -2
View File
@@ -21,12 +21,12 @@ class NaNTest(unittest.TestCase):
} }
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.simplefilter("ignore", category=UserWarning) 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() self.data._create_schema()
def test_load(self): def test_load(self):
with self.assertWarns(UserWarning): 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): def test_init(self):
self.assertEqual(self.data.cell_count, 100) self.assertEqual(self.data.cell_count, 100)
+6 -6
View File
@@ -19,13 +19,13 @@ Test the scanpy engine using the pbmc3k data set.
@parameterized_class(("data_locator", "backed"), [ @parameterized_class(("data_locator", "backed"), [
("example-dataset/pbmc3k.h5ad", False), ("../example-dataset/pbmc3k.h5ad", False),
("server/test/test_datasets/pbmc3k-CSC-gz.h5ad", False), ("test/test_datasets/pbmc3k-CSC-gz.h5ad", False),
("server/test/test_datasets/pbmc3k-CSR-gz.h5ad", False), ("test/test_datasets/pbmc3k-CSR-gz.h5ad", False),
("example-dataset/pbmc3k.h5ad", True), ("../example-dataset/pbmc3k.h5ad", True),
("server/test/test_datasets/pbmc3k-CSC-gz.h5ad", True), ("test/test_datasets/pbmc3k-CSC-gz.h5ad", True),
("server/test/test_datasets/pbmc3k-CSR-gz.h5ad", True), ("test/test_datasets/pbmc3k-CSR-gz.h5ad", True),
]) ])
class EngineTest(unittest.TestCase): class EngineTest(unittest.TestCase):
def setUp(self): def setUp(self):
+2 -2
View File
@@ -11,7 +11,7 @@ class DataLoadEngineTest(unittest.TestCase):
Test file loading, including deferred loading/update. Test file loading, including deferred loading/update.
""" """
def setUp(self): def setUp(self):
self.data_file = DataLocator("example-dataset/pbmc3k.h5ad") self.data_file = DataLocator("../example-dataset/pbmc3k.h5ad")
self.data = ScanpyEngine() self.data = ScanpyEngine()
def test_init(self): def test_init(self):
@@ -76,7 +76,7 @@ class DataLocatorEngineTest(unittest.TestCase):
self.assertEqual(data.gene_count, 1838) self.assertEqual(data.gene_count, 1838)
def test_posix_file(self): def test_posix_file(self):
locator = DataLocator("example-dataset/pbmc3k.h5ad") locator = DataLocator("../example-dataset/pbmc3k.h5ad")
data = ScanpyEngine(locator, self.args) data = ScanpyEngine(locator, self.args)
self.stdAsserts(data) self.stdAsserts(data)
+1 -1
View File
@@ -27,7 +27,7 @@ class WritableAnnotationTest(unittest.TestCase):
"annotations_file": self.annotations_file, "annotations_file": self.annotations_file,
"annotations_output_dir": None "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): def tearDown(self):
shutil.rmtree(self.tmpDir) shutil.rmtree(self.tmpDir)
-5
View File
@@ -1,5 +0,0 @@
set -eo pipefail
make lint
npm run --prefix client/ build
npm run --prefix client/ unit-test
pytest -s server/test