From db31fdbb0e98d35c4852f6e0b514c4f56e7eba24 Mon Sep 17 00:00:00 2001 From: peusterm Date: Wed, 11 May 2016 15:50:11 +0200 Subject: [PATCH] preparation for integration tests --- src/emuvim/test/__main__.py | 7 --- src/emuvim/test/integrationtests/__init__.py | 0 .../test_sonata_dummy_gatekeeper.py | 0 src/emuvim/test/runner.py | 52 ------------------- src/emuvim/test/test_api_zerorpc.py | 1 - src/emuvim/test/unittests/__init__.py | 0 .../test/{ => unittests}/test_emulator.py | 0 .../{ => unittests}/test_resourcemodel.py | 0 utils/ci/build_01_unit_tests.sh | 2 +- 9 files changed, 1 insertion(+), 61 deletions(-) delete mode 100755 src/emuvim/test/__main__.py create mode 100644 src/emuvim/test/integrationtests/__init__.py rename src/emuvim/test/{ => integrationtests}/test_sonata_dummy_gatekeeper.py (100%) delete mode 100755 src/emuvim/test/runner.py delete mode 100755 src/emuvim/test/test_api_zerorpc.py create mode 100644 src/emuvim/test/unittests/__init__.py rename src/emuvim/test/{ => unittests}/test_emulator.py (100%) rename src/emuvim/test/{ => unittests}/test_resourcemodel.py (100%) diff --git a/src/emuvim/test/__main__.py b/src/emuvim/test/__main__.py deleted file mode 100755 index f7fa66d..0000000 --- a/src/emuvim/test/__main__.py +++ /dev/null @@ -1,7 +0,0 @@ -import runner -import os - - -if __name__ == '__main__': - thisdir = os.path.dirname( os.path.realpath( __file__ ) ) - runner.main(thisdir) diff --git a/src/emuvim/test/integrationtests/__init__.py b/src/emuvim/test/integrationtests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/emuvim/test/test_sonata_dummy_gatekeeper.py b/src/emuvim/test/integrationtests/test_sonata_dummy_gatekeeper.py similarity index 100% rename from src/emuvim/test/test_sonata_dummy_gatekeeper.py rename to src/emuvim/test/integrationtests/test_sonata_dummy_gatekeeper.py diff --git a/src/emuvim/test/runner.py b/src/emuvim/test/runner.py deleted file mode 100755 index 469a99e..0000000 --- a/src/emuvim/test/runner.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python - -""" -Run all tests - -v : verbose output - -e : emulator test only (no API tests) - -a : API tests only -""" - -from unittest import defaultTestLoader, TextTestRunner, TestSuite -import os -import sys -from mininet.util import ensureRoot -from mininet.clean import cleanup -from mininet.log import setLogLevel - - -def runTests( testDir, verbosity=1, emuonly=False, apionly=False ): - "discover and run all tests in testDir" - # ensure inport paths work - sys.path.append("%s/.." % testDir) - # ensure root and cleanup before starting tests - ensureRoot() - cleanup() - # discover all tests in testDir - testSuite = defaultTestLoader.discover( testDir ) - if emuonly: - testSuiteFiltered = [s for s in testSuite if "Emulator" in str(s)] - testSuite = TestSuite() - testSuite.addTests(testSuiteFiltered) - if apionly: - testSuiteFiltered = [s for s in testSuite if "Api" in str(s)] - testSuite = TestSuite() - testSuite.addTests(testSuiteFiltered) - - # run tests - TextTestRunner( verbosity=verbosity ).run( testSuite ) - - -def main(thisdir): - setLogLevel( 'warning' ) - # get the directory containing example tests - vlevel = 2 if '-v' in sys.argv else 1 - emuonly = ('-e' in sys.argv) - apionly = ('-a' in sys.argv) - runTests( - testDir=thisdir, verbosity=vlevel, emuonly=emuonly, apionly=apionly) - - -if __name__ == '__main__': - thisdir = os.path.dirname( os.path.realpath( __file__ ) ) - main(thisdir) diff --git a/src/emuvim/test/test_api_zerorpc.py b/src/emuvim/test/test_api_zerorpc.py deleted file mode 100755 index 2830872..0000000 --- a/src/emuvim/test/test_api_zerorpc.py +++ /dev/null @@ -1 +0,0 @@ -#TODO we'll need this at some time. But I'am lazy. A good REST API seems to be more important. diff --git a/src/emuvim/test/unittests/__init__.py b/src/emuvim/test/unittests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/emuvim/test/test_emulator.py b/src/emuvim/test/unittests/test_emulator.py similarity index 100% rename from src/emuvim/test/test_emulator.py rename to src/emuvim/test/unittests/test_emulator.py diff --git a/src/emuvim/test/test_resourcemodel.py b/src/emuvim/test/unittests/test_resourcemodel.py similarity index 100% rename from src/emuvim/test/test_resourcemodel.py rename to src/emuvim/test/unittests/test_resourcemodel.py diff --git a/utils/ci/build_01_unit_tests.sh b/utils/ci/build_01_unit_tests.sh index ab6ece3..5544503 100755 --- a/utils/ci/build_01_unit_tests.sh +++ b/utils/ci/build_01_unit_tests.sh @@ -10,4 +10,4 @@ cd ${BASE_DIR} rm -rf utils/ci/junit-xml/* # Launch the unit testing on emuvim -py.test -v --junit-xml=utils/ci/junit-xml/pytest_emuvim.xml src/emuvim +py.test -v --junit-xml=utils/ci/junit-xml/pytest_emuvim.xml src/emuvim/test/unittests -- 2.25.1