Created
July 7, 2014 12:20
-
-
Save chris-allan/52abb128fb2a43f67070 to your computer and use it in GitHub Desktop.
pytest plugin bug test case
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
""" | |
""" | |
import sys | |
from setuptools import setup, find_packages | |
from setuptools.command.test import test as TestCommand | |
class PyTest(TestCommand): | |
def finalize_options(self): | |
TestCommand.finalize_options(self) | |
self.test_args = [ | |
'--pep8', | |
'--clearcache' | |
] | |
self.test_suite = True | |
def run_tests(self): | |
import pytest | |
errno = pytest.main(self.test_args) | |
sys.exit(errno) | |
class ShowProblems(TestCommand): | |
def finalize_options(self): | |
TestCommand.finalize_options(self) | |
self.test_args = [] | |
self.test_suite = True | |
def run_tests(self): | |
import pkg_resources | |
print 'dumping initial entry points...' | |
for ep in pkg_resources.working_set.iter_entry_points('pytest11'): | |
print ' entry point: %r' % ep | |
print 'trying to loop through entry points and loading pytest-pep8...' | |
for ep in pkg_resources.working_set.iter_entry_points('pytest11'): | |
print ' entry point: %r' % ep | |
if ep.name == 'pep8': | |
ep.load() | |
print 'dumping entry points after plugin load...' | |
for ep in pkg_resources.working_set.iter_entry_points('pytest11'): | |
print ' entry point: %r' % ep | |
setup( | |
name='PyTest-Test', | |
version='0.1', | |
packages=find_packages(), | |
platforms='any', | |
tests_require=[ | |
'pytest>=2.5.2', | |
'pytest-pep8>=1.0.5' | |
], | |
cmdclass={ | |
'test': PyTest, | |
'show_problems': ShowProblems | |
}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment