diff --git a/.gitignore b/.gitignore index 3a1fc74..6a022d2 100644 --- a/.gitignore +++ b/.gitignore @@ -86,4 +86,5 @@ target/ # Project /src/hematopy/http/images -*.pid \ No newline at end of file +*.pid +.pytest_cache \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..9af7e6f --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[aliases] +test=pytest \ No newline at end of file diff --git a/setup.py b/setup.py index 41de032..777e2b1 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,7 @@ long_description_content_type='text/markdown', package_dir={'': 'src'}, packages=setuptools.find_packages(where='src'), + setup_requires=['pytest-runner'], install_requires=[ 'CairoSVG==2.1.3', 'click==6.7', @@ -23,6 +24,9 @@ 'lxml==4.2.1', 'python-magic==0.4.15' ], + tests_require = [ + 'pytest-console-scripts==0.1.5', + ], # package_dir={'':'hematopy'}, entry_points = { 'console_scripts': [ diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..f5005db --- /dev/null +++ b/tests/README.md @@ -0,0 +1,7 @@ +## Services + +- https://travis-ci.org/ArgoCrew/hematopy + +## References + +- https://github.com/kvas-it/pytest-console-scripts \ No newline at end of file diff --git a/tests/hematopy/test_donation.py b/tests/hematopy/test_donation.py new file mode 100644 index 0000000..c550ab2 --- /dev/null +++ b/tests/hematopy/test_donation.py @@ -0,0 +1,9 @@ +CONSOLE_SCRIPT_NAME = 'hematopy' + +def test_cli_help(script_runner): + must_have = ('Usage: hematopy [OPTIONS] COMMAND [ARGS]...') + ret = script_runner.run('hematopy', '--help') + + assert ret.success + assert must_have[0] in ret.stdout + assert ret.stderr == '' \ No newline at end of file