From c08bd2af4548cc97585f9f803748de46c69d0cba Mon Sep 17 00:00:00 2001 From: Nicole Story Date: Tue, 11 Dec 2018 10:09:26 -0600 Subject: [PATCH 1/2] Unit testing framework --- voltha/adapters/adtran_olt/.coveragerc | 2 ++ voltha/adapters/adtran_olt/.gitignore | 2 ++ voltha/adapters/adtran_olt/Makefile | 36 +++++++++++++++++++ voltha/adapters/adtran_olt/test/__init__.py | 0 .../adapters/adtran_olt/test/test_example.py | 4 +++ .../adapters/adtran_olt/test_requirements.txt | 4 +++ 6 files changed, 48 insertions(+) create mode 100644 voltha/adapters/adtran_olt/.coveragerc create mode 100644 voltha/adapters/adtran_olt/.gitignore create mode 100644 voltha/adapters/adtran_olt/Makefile create mode 100644 voltha/adapters/adtran_olt/test/__init__.py create mode 100644 voltha/adapters/adtran_olt/test/test_example.py create mode 100644 voltha/adapters/adtran_olt/test_requirements.txt diff --git a/voltha/adapters/adtran_olt/.coveragerc b/voltha/adapters/adtran_olt/.coveragerc new file mode 100644 index 00000000..053d1977 --- /dev/null +++ b/voltha/adapters/adtran_olt/.coveragerc @@ -0,0 +1,2 @@ +[run] +omit = venv/*, test/* diff --git a/voltha/adapters/adtran_olt/.gitignore b/voltha/adapters/adtran_olt/.gitignore new file mode 100644 index 00000000..99e78d8f --- /dev/null +++ b/voltha/adapters/adtran_olt/.gitignore @@ -0,0 +1,2 @@ +htmlcov/ +venv/ diff --git a/voltha/adapters/adtran_olt/Makefile b/voltha/adapters/adtran_olt/Makefile new file mode 100644 index 00000000..efa5fc7e --- /dev/null +++ b/voltha/adapters/adtran_olt/Makefile @@ -0,0 +1,36 @@ +THIS_MAKEFILE := $(abspath $(MAKEFILE_LIST) ) +WORKING_DIR := $(dir $(THIS_MAKEFILE) ) +ADAPTERS_DIR := $(dir $(patsubst %/,%,$(WORKING_DIR))) +VOLTHA_DIR := $(dir $(patsubst %/,%,$(ADAPTERS_DIR))) + +VENVDIR=$(WORKING_DIR)venv +TESTDIR=$(WORKING_DIR)test + +ADD_TO_PYTHONPATH := export PYTHONPATH=$(VOLTHA_DIR)/protos/third_party; +IN_VENV=. '$(VENVDIR)/bin/activate'; $(ADD_TO_PYTHONPATH) + +PROFILING=--profile-svg +DOT := $(shell command -v dot 2> /dev/null) +ifndef DOT +$(warning "dot is not available please install graphviz") +PROFILING= +endif + +RUN_PYTEST=$(IN_VENV) python -m pytest -vvlx $(PROFILING) --cov=$(WORKING_DIR) --cov-report term-missing --cov-report html + +$(VENVDIR): + @virtualenv -p python2 $(VENVDIR) + @virtualenv -p python2 --relocatable $(VENVDIR) + +.PHONY: create-venv +create-venv: $(VENVDIR) + +.PHONY: test +test: create-venv + @$(IN_VENV) command -v py.test > /dev/null 2>&1 || `echo >&2 "'make requirements' first. Aborting."; exit 1;` + @rm -rf $(TESTDIR)/__pycache__ + @cd $(WORKING_DIR) && $(RUN_PYTEST) $(TESTDIR) + +.PHONY: requirements +requirements: create-venv + @$(IN_VENV) pip install --upgrade -r test_requirements.txt diff --git a/voltha/adapters/adtran_olt/test/__init__.py b/voltha/adapters/adtran_olt/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/voltha/adapters/adtran_olt/test/test_example.py b/voltha/adapters/adtran_olt/test/test_example.py new file mode 100644 index 00000000..a1c9da66 --- /dev/null +++ b/voltha/adapters/adtran_olt/test/test_example.py @@ -0,0 +1,4 @@ +from voltha.adapters.adtran_olt import adtran_olt + +def test_example(): + assert True diff --git a/voltha/adapters/adtran_olt/test_requirements.txt b/voltha/adapters/adtran_olt/test_requirements.txt new file mode 100644 index 00000000..4d8a4014 --- /dev/null +++ b/voltha/adapters/adtran_olt/test_requirements.txt @@ -0,0 +1,4 @@ +-r ../../../requirements.txt +pytest >= 3.0, < 4.0 +pytest-cov >= 2.1.0, < 3.0 +pytest-profiling >= 1.1.1, < 2.0 From 83a8ff381cc4a34f46549816e51130e783d02c16 Mon Sep 17 00:00:00 2001 From: balajipurushothama Date: Mon, 10 Dec 2018 10:22:26 -0600 Subject: [PATCH 2/2] This the test for the review process --- voltha/adapters/adtran_onu/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/voltha/adapters/adtran_onu/README.md b/voltha/adapters/adtran_onu/README.md index d64a2518..5d35f576 100644 --- a/voltha/adapters/adtran_onu/README.md +++ b/voltha/adapters/adtran_onu/README.md @@ -1,2 +1,3 @@ # adtran_onu +# This is the test for review process VOLTHA ONU Device Adapter for Adtran ONU/ONTs