From 5b6ce2a63a2408638bb7636639abfb1c771585d5 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 24 Feb 2014 20:16:10 -0600 Subject: some style fixes suggested by pep8-naming --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 81a50f44..a2a75504 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ requirements = [ ] -class cffi_build(build): +class CFFIBuild(build): """ This class exists, instead of just providing ``ext_modules=[...]`` directly in ``setup()`` because importing cryptography requires we have several @@ -110,6 +110,6 @@ setup( zip_safe=False, ext_package="cryptography", cmdclass={ - "build": cffi_build, + "build": CFFIBuild, } ) -- cgit v1.2.3 From ff0dd1e000eb4a1552bf59dcdb78db1bd3708721 Mon Sep 17 00:00:00 2001 From: koobs Date: Mon, 24 Feb 2014 21:55:04 +1100 Subject: Integrate py.test enabling `python setup.py test` Integrate py.test according to: https://pytest.org/latest/goodpractises.html#integration-with-setuptools-test-commands Enables use of standard python setup.py test command. Very handy for OS packagers & porters for QA, in this case the FreeBSD Port for cryptography which just landed. --- setup.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index a2a75504..ecf0f5ea 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ import os from distutils.command.build import build from setuptools import setup, find_packages - +from setuptools.command.test import test as TestCommand base_dir = os.path.dirname(__file__) @@ -31,6 +31,12 @@ requirements = [ SIX_DEPENDENCY ] +test_requirements = [ + "pytest", + "pretend", + "iso8601" +] + class CFFIBuild(build): """ @@ -63,6 +69,17 @@ class CFFIBuild(build): build.finalize_options(self) +class PyTest(TestCommand): + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = [] + self.test_suite = True + def run_tests(self): + #import here, cause outside the eggs aren't loaded + import pytest + errno = pytest.main(self.test_args) + sys.exit(errno) + with open(os.path.join(base_dir, "README.rst")) as f: long_description = f.read() @@ -105,11 +122,13 @@ setup( install_requires=requirements, setup_requires=requirements, + tests_require=test_requirements, # for cffi zip_safe=False, ext_package="cryptography", cmdclass={ "build": CFFIBuild, + "test": PyTest, } ) -- cgit v1.2.3 From 92a4cdbd926a95fc3cfe8428700469938bf3a73f Mon Sep 17 00:00:00 2001 From: koobs Date: Mon, 24 Feb 2014 22:13:17 +1100 Subject: Add new lines (pep8) and use full sentences --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index ecf0f5ea..48343ca0 100644 --- a/setup.py +++ b/setup.py @@ -69,13 +69,14 @@ class CFFIBuild(build): build.finalize_options(self) + class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) self.test_args = [] self.test_suite = True def run_tests(self): - #import here, cause outside the eggs aren't loaded + # Import here because in module scope the eggs are not loaded. import pytest errno = pytest.main(self.test_args) sys.exit(errno) -- cgit v1.2.3 From 23690dd8f86665ccff87dcb9850fc68bcfc4c371 Mon Sep 17 00:00:00 2001 From: koobs Date: Mon, 24 Feb 2014 22:26:23 +1100 Subject: pep8: Add import (sys) and newline --- setup.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 48343ca0..df29b042 100644 --- a/setup.py +++ b/setup.py @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import os +import sys from distutils.command.build import build from setuptools import setup, find_packages @@ -75,6 +76,7 @@ class PyTest(TestCommand): TestCommand.finalize_options(self) self.test_args = [] self.test_suite = True + def run_tests(self): # Import here because in module scope the eggs are not loaded. import pytest -- cgit v1.2.3 From 066718022e8cb1c9e6326d944c99280905ad0a82 Mon Sep 17 00:00:00 2001 From: koobs Date: Mon, 24 Feb 2014 22:33:07 +1100 Subject: And again. Remove whitespace (pep8) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index df29b042..681b9031 100644 --- a/setup.py +++ b/setup.py @@ -76,7 +76,7 @@ class PyTest(TestCommand): TestCommand.finalize_options(self) self.test_args = [] self.test_suite = True - + def run_tests(self): # Import here because in module scope the eggs are not loaded. import pytest -- cgit v1.2.3 From acac6a6ed57458adc2ecda36c51382660e5269df Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 4 Mar 2014 15:24:03 -0800 Subject: Follow the rules --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 681b9031..cfbab310 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ import sys from distutils.command.build import build from setuptools import setup, find_packages -from setuptools.command.test import test as TestCommand +from setuptools.command.test import test base_dir = os.path.dirname(__file__) @@ -71,7 +71,7 @@ class CFFIBuild(build): build.finalize_options(self) -class PyTest(TestCommand): +class PyTest(test): def finalize_options(self): TestCommand.finalize_options(self) self.test_args = [] -- cgit v1.2.3 From 6858cd42e0ceb31d873052eba9f68406cd3aa03a Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 4 Mar 2014 15:33:13 -0800 Subject: The worst. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index cfbab310..238ee9b7 100644 --- a/setup.py +++ b/setup.py @@ -73,7 +73,7 @@ class CFFIBuild(build): class PyTest(test): def finalize_options(self): - TestCommand.finalize_options(self) + test.finalize_options(self) self.test_args = [] self.test_suite = True -- cgit v1.2.3