[virt-tools-list] [virt-bootstrap] [PATCH v4 07/13] tests: Add test suite

Radostin Stoyanov rstoyanov1 at gmail.com
Fri Jul 21 12:13:23 UTC 2017


Tests can be started with: `./setup.py test`
---
 README.md | 12 ++++++++++++
 setup.py  |  5 ++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 7451421..d7f194f 100644
--- a/README.md
+++ b/README.md
@@ -21,3 +21,15 @@ use the run script. For example to run virt-bootstrap, use a command
 like the following one:
 
     ./run src/virtBootstrap/virt-bootstrap.py --help
+
+The following commands will be useful for anyone writing patches:
+
+    ./setup.py test      # Run local unit test suite
+    ./setup.py pylint    # Run a pylint script against the codebase
+
+Any patches shouldn't change the output of 'test' or 'pylint'. The 'pylint' requires `pylint` and `pycodestyle` to be installed.
+
+If [coverage](https://pypi.python.org/pypi/coverage/) is installed, you can generate report using:
+
+    coverage run --source=virtBootstrap ./setup.py test
+    coverage report
diff --git a/setup.py b/setup.py
index 36de2d5..2f299b6 100755
--- a/setup.py
+++ b/setup.py
@@ -50,7 +50,7 @@ class CheckPylint(Command):
         """
 
         res = 0
-        files = ' '.join(["setup.py", "src/virtBootstrap/*.py"])
+        files = ' '.join(["setup.py", "src/virtBootstrap/*.py", "tests/*.py"])
         output_format = "colorized" if sys.stdout.isatty() else "text"
 
         print(">>> Running pycodestyle ...")
@@ -82,6 +82,7 @@ setup(
     keywords='virtualization container rootfs',
     package_dir={"": "src"},
     packages=['virtBootstrap'],
+    test_suite='tests',
     entry_points={
         'console_scripts': [
             'virt-bootstrap=virtBootstrap.virt_bootstrap:main',
@@ -117,6 +118,8 @@ setup(
     # root password for root file system.
     install_requires=['passlib>=1.6.1'],
 
+    tests_require=['mock>=2.0'],
+
     extras_require={
         'dev': [
             'pylint',
-- 
2.9.4




More information about the virt-tools-list mailing list