forked from opencord/voltha
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request opencord#2 from nstory/master
Unit test framework for the OLT adapter
- Loading branch information
Showing
6 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
omit = venv/*, test/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
htmlcov/ | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from voltha.adapters.adtran_olt import adtran_olt | ||
|
||
def test_example(): | ||
assert True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |