Update xos-tosca to use nose2 for testing
Change-Id: I74575310d3611f75da22532f668437c302cf4a29
diff --git a/.gitignore b/.gitignore
index afc1bc2..24478e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,7 +5,8 @@
src/tosca/tmp.yaml
src/grpc_client/KEYS.py
-# Test Coverage
+# Test output
+nose2-junit.xml
.coverage
cover
coverage.xml
diff --git a/Dockerfile b/Dockerfile
index 2f6bd48..5fec234 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -12,7 +12,7 @@
COPY ${CODE_SOURCE}/ ${CODE_DEST}/
# Install dependencies
-RUN pip install -r ${CODE_DEST}/pip_requirements.txt
+RUN pip install klein==16.12.0
EXPOSE 9102
diff --git a/Makefile b/Makefile
index d0f6c43..b91ee28 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
help:
- @echo "tests: Run unit tests (if you're running local, you'll need to have virtual-env activated)"
+ @echo "tests: Run unit tests (need the xos dev virtual-env activated)"
@echo "tosca: Generate tosca definition from core.xproto"
@echo "build: Build the docker image for xos-tosca"
@echo "start: Run an xos-tosca container"
@@ -8,7 +8,7 @@
@echo "test-delete: Delete a sample tosca recipe"
tests: tosca
- nosetests -s -v --with-id --with-coverage --cover-html --cover-erase --cover-xml --cover-package="grpc_client, tosca"
+ nose2 --verbose --coverage-report xml --coverage-report term --junit-xml
build:
docker build -t xosproject/xos-tosca .
@@ -29,4 +29,4 @@
tosca:
xosgenx --target=src/tosca/xtarget/tosca.xtarget --output=src/tosca/custom_types --write-to-file=target ../xos/xos/core/models/core.xproto
- xosgenx --target=src/tosca/xtarget/tosca_keys.xtarget --output=src/grpc_client/ --write-to-file=single --dest-file=KEYS.py ../xos/xos/core/models/core.xproto
\ No newline at end of file
+ xosgenx --target=src/tosca/xtarget/tosca_keys.xtarget --output=src/grpc_client/ --write-to-file=single --dest-file=KEYS.py ../xos/xos/core/models/core.xproto
diff --git a/README.md b/README.md
index 4812ea6..9f2c88c 100644
--- a/README.md
+++ b/README.md
@@ -20,3 +20,15 @@
**Wiki**<br/>
[wiki.opencord.org](https://wiki.opencord.org/)
+
+## Testing
+
+To run tests, you must first create a virtualenv with the XOS dependencies:
+
+```shell
+cd ../xos
+./scripts/setup_venv.sh
+source venv-xos/bin/activate
+cd ../xos-tosca
+make tests
+```
diff --git a/pip_requirements.txt b/pip_requirements.txt
deleted file mode 100644
index 36891a6..0000000
--- a/pip_requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-klein==16.12.0
-coverage==4.4.1
\ No newline at end of file
diff --git a/unittest.cfg b/unittest.cfg
new file mode 100644
index 0000000..f7d64b7
--- /dev/null
+++ b/unittest.cfg
@@ -0,0 +1,7 @@
+[unittest]
+plugins=nose2.plugins.junitxml
+
+[coverage]
+always-on = True
+coverage-report = term
+coverage-report = xml