From Nikolaus at rath.org Mon Feb 10 04:51:31 2014 From: Nikolaus at rath.org (Nikolaus Rath) Date: Sun, 09 Feb 2014 19:51:31 -0800 Subject: [pytest-dev] Parametrized fixture fails when using unittest Message-ID: <87k3d3tykc.fsf@vostro.rath.org> Hello, I don't understand why the following test fixture works for the test function, but fails for the test method. Am I doing something wrong, or is this a bug? $ cat t0_mine.py import pytest import unittest @pytest.yield_fixture(params=(0,1,2)) def param1(request): if request.param == 1: pytest.skip('not so good') yield request.param @pytest.fixture(params=('a','b')) def param2(request, param1): return (param1, request.param) @pytest.fixture() def param1a(request, param1): if param1 == 1: return 0 else: return 7 def test_function(param2, param1a): if param2[0] == 1: assert param1a == 0 else: assert param1a == 7 @pytest.mark.usefixtures('param2', 'param1a') $ py.test-3 t0_mine.py -v ==================================== test session starts ==================================== platform linux -- Python 3.3.3 -- pytest-2.5.1 -- /usr/bin/python3 collected 7 items t0_mine.py:25: test_function[a-0] PASSED t0_mine.py:25: test_function[a-1] SKIPPED t0_mine.py:25: test_function[a-2] PASSED t0_mine.py:25: test_function[b-0] PASSED t0_mine.py:25: test_function[b-1] SKIPPED t0_mine.py:25: test_function[b-2] PASSED t0_mine.py:33: TestClass.test_method ERROR ========================================== ERRORS =========================================== __________________________ ERROR at setup of TestClass.test_method __________________________ request = > @pytest.yield_fixture(params=(0,1,2)) def param1(request): > if request.param == 1: E AttributeError: 'SubRequest' object has no attribute 'param' t0_mine.py:9: AttributeError ======================= 4 passed, 2 skipped, 1 error in 0.02 seconds ======================== Best, Nikolaus -- Encrypted emails preferred. PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C ?Time flies like an arrow, fruit flies like a Banana.? From florian.schulze at gmx.net Mon Feb 10 09:54:05 2014 From: florian.schulze at gmx.net (Florian Schulze) Date: Mon, 10 Feb 2014 09:54:05 +0100 Subject: [pytest-dev] Parametrized fixture fails when using unittest In-Reply-To: <87k3d3tykc.fsf@vostro.rath.org> References: <87k3d3tykc.fsf@vostro.rath.org> Message-ID: <2052FB01-6D77-4924-B3AF-741270EBF138@gmx.net> Hi! You didn't include the test_method, maybe you just forgot the 'self' as first parameter? Regards, Florian Schulze On 10 Feb 2014, at 4:51, Nikolaus Rath wrote: > Hello, > > I don't understand why the following test fixture works for the test > function, but fails for the test method. Am I doing something wrong, > or > is this a bug? > > $ cat t0_mine.py > import pytest > import unittest > > @pytest.yield_fixture(params=(0,1,2)) > def param1(request): > if request.param == 1: > pytest.skip('not so good') > > yield request.param > > @pytest.fixture(params=('a','b')) > def param2(request, param1): > return (param1, request.param) > > @pytest.fixture() > def param1a(request, param1): > if param1 == 1: > return 0 > else: > return 7 > > def test_function(param2, param1a): > if param2[0] == 1: > assert param1a == 0 > else: > assert param1a == 7 > > @pytest.mark.usefixtures('param2', 'param1a') > > $ py.test-3 t0_mine.py -v > ==================================== test session starts > ==================================== > platform linux -- Python 3.3.3 -- pytest-2.5.1 -- /usr/bin/python3 > collected 7 items > > t0_mine.py:25: test_function[a-0] PASSED > t0_mine.py:25: test_function[a-1] SKIPPED > t0_mine.py:25: test_function[a-2] PASSED > t0_mine.py:25: test_function[b-0] PASSED > t0_mine.py:25: test_function[b-1] SKIPPED > t0_mine.py:25: test_function[b-2] PASSED > t0_mine.py:33: TestClass.test_method ERROR > > ========================================== ERRORS > =========================================== > __________________________ ERROR at setup of TestClass.test_method > __________________________ > > request = > > > @pytest.yield_fixture(params=(0,1,2)) > def param1(request): >> if request.param == 1: > E AttributeError: 'SubRequest' object has no attribute 'param' > > t0_mine.py:9: AttributeError > ======================= 4 passed, 2 skipped, 1 error in 0.02 seconds > ======================== > > > > Best, > Nikolaus > > > -- > Encrypted emails preferred. > PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C > > ?Time flies like an arrow, fruit flies like a Banana.? > _______________________________________________ > Pytest-dev mailing list > Pytest-dev at python.org > https://mail.python.org/mailman/listinfo/pytest-dev From Nikolaus at rath.org Mon Feb 10 17:45:34 2014 From: Nikolaus at rath.org (Nikolaus Rath) Date: Mon, 10 Feb 2014 08:45:34 -0800 Subject: [pytest-dev] Parametrized fixture fails when using unittest In-Reply-To: <2052FB01-6D77-4924-B3AF-741270EBF138@gmx.net> (Florian Schulze's message of "Mon, 10 Feb 2014 09:54:05 +0100") References: <87k3d3tykc.fsf@vostro.rath.org> <2052FB01-6D77-4924-B3AF-741270EBF138@gmx.net> Message-ID: <87d2iuncgh.fsf@rath.org> Hi, Seems you can't even trust copy and paste anymore... no idea how that happened. Here's the missing part (so no, self is not missing): [...] @pytest.mark.usefixtures('param2', 'param1a') class TestClass(unittest.TestCase): def test_method(self): if self.param2[0] == 1: assert self.param1a == 0 else: assert self.param1a == 7 Thanks, -Nikolaus "Florian Schulze" writes: > Hi! > > You didn't include the test_method, maybe you just forgot the 'self' > as first parameter? > > Regards, > Florian Schulze > > > On 10 Feb 2014, at 4:51, Nikolaus Rath wrote: > >> Hello, >> >> I don't understand why the following test fixture works for the test >> function, but fails for the test method. Am I doing something wrong, >> or >> is this a bug? >> >> $ cat t0_mine.py >> import pytest >> import unittest >> >> @pytest.yield_fixture(params=(0,1,2)) >> def param1(request): >> if request.param == 1: >> pytest.skip('not so good') >> >> yield request.param >> >> @pytest.fixture(params=('a','b')) >> def param2(request, param1): >> return (param1, request.param) >> >> @pytest.fixture() >> def param1a(request, param1): >> if param1 == 1: >> return 0 >> else: >> return 7 >> >> def test_function(param2, param1a): >> if param2[0] == 1: >> assert param1a == 0 >> else: >> assert param1a == 7 >> >> @pytest.mark.usefixtures('param2', 'param1a') >> >> $ py.test-3 t0_mine.py -v >> ==================================== test session starts >> ==================================== >> platform linux -- Python 3.3.3 -- pytest-2.5.1 -- /usr/bin/python3 >> collected 7 items >> >> t0_mine.py:25: test_function[a-0] PASSED >> t0_mine.py:25: test_function[a-1] SKIPPED >> t0_mine.py:25: test_function[a-2] PASSED >> t0_mine.py:25: test_function[b-0] PASSED >> t0_mine.py:25: test_function[b-1] SKIPPED >> t0_mine.py:25: test_function[b-2] PASSED >> t0_mine.py:33: TestClass.test_method ERROR >> >> ========================================== ERRORS >> =========================================== >> __________________________ ERROR at setup of TestClass.test_method >> __________________________ >> >> request = > >> >> @pytest.yield_fixture(params=(0,1,2)) >> def param1(request): >>> if request.param == 1: >> E AttributeError: 'SubRequest' object has no attribute 'param' >> >> t0_mine.py:9: AttributeError >> ======================= 4 passed, 2 skipped, 1 error in 0.02 seconds >> ======================== >> >> >> >> Best, >> Nikolaus >> >> >> -- >> Encrypted emails preferred. >> PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C >> >> ?Time flies like an arrow, fruit flies like a Banana.? >> _______________________________________________ >> Pytest-dev mailing list >> Pytest-dev at python.org >> https://mail.python.org/mailman/listinfo/pytest-dev > _______________________________________________ > Pytest-dev mailing list > Pytest-dev at python.org > https://mail.python.org/mailman/listinfo/pytest-dev -- Encrypted emails preferred. PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C ?Time flies like an arrow, fruit flies like a Banana.? From mount.sarah at gmail.com Mon Feb 17 10:16:10 2014 From: mount.sarah at gmail.com (Sarah Mount) Date: Mon, 17 Feb 2014 09:16:10 +0000 Subject: [pytest-dev] py.test and decorators In-Reply-To: References: <20140123180814.GU22354@merlinux.eu> <20140123183008.GW22354@merlinux.eu> Message-ID: Sorry to be a pain, I realise everyone here is a volunteer, but is there a way to move this issue forward? I have quite a bit of work blocked on getting py.test to work on my repo currently, and I'd rather use py.test than any other framework. I'm more than happy to put in more effort to narrow the bug down or take some of the next steps myself, but at this stage I'm not really sure where to start... Thanks, Sarah On Fri, Jan 24, 2014 at 9:35 AM, Sarah Mount wrote: > On 1/23/14, holger krekel wrote: > > On Thu, Jan 23, 2014 at 18:27 +0000, Sarah Mount wrote: > >> The tests were completely ad-hoc and did not use unittest or any other > >> library. They had a hand-rolled runner which ran all the functions like > >> test_one_one from a script. > >> > >> The odd thing is that Python 2.7 + py.test + the functools.wraps version > >> of > >> the decorators worked OK. > >> > >> Could it be that I have inadvertently turned the logging module on and > >> output from that is confusing the py.test runner? > > > > wouldn't think so. Can you attach a zip file and state the dependencies > > so we can try to reproduce? Or a repo-url? > > > > Many thanks, I am reluctant to give you a repo-url since there is so > much code in there that is irrelevant to this issue it would be hard > to figure out what is going on. > > The attached zip contains the minimum code to reproduce. If you run > "show_bug.sh" from the pytest-bug directory this will: > > 1) install the requirements via pip, > > 2) run a single test from vanilla python (should pass), > > 3) run the same test with py.test (should green at this stage) and > > 4) display some text explaining what to uncomment to reproduce the bug. > > I have narrowed it down quite a bit, and it turns out that if you > comment out most of the code in base.py everything works just fine... > which is odd. > > Thanks for your help, > > Sarah > > -- > Sarah Mount, Senior Lecturer, University of Wolverhampton > website: http://www.snim2.org/ > twitter: @snim2 > -- Sarah Mount, Senior Lecturer, University of Wolverhampton website: http://www.snim2.org/ twitter: @snim2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From flub at devork.be Thu Feb 20 22:07:13 2014 From: flub at devork.be (Floris Bruynooghe) Date: Thu, 20 Feb 2014 21:07:13 +0000 Subject: [pytest-dev] Parametrized fixture fails when using unittest In-Reply-To: <87d2iuncgh.fsf@rath.org> References: <87k3d3tykc.fsf@vostro.rath.org> <2052FB01-6D77-4924-B3AF-741270EBF138@gmx.net> <87d2iuncgh.fsf@rath.org> Message-ID: Hi Nikolaus, I'm not sure about your TestClass at all and wasn't aware that using a unitest.TestCase class with parameterisation could even possibly work like this, but it seems to at least partially. However re-writing the TestClass without using unittest it works fine and simple: class TestCase: def test_method(self, param2, param1a): if param2[0] == 1: assert param1a == 0 else: assert param1a == 7 So if you can maybe avoid using the parameterisation mark with unitest.TestCase classes? Regards, Floris On 10 February 2014 16:45, Nikolaus Rath wrote: > Hi, > > Seems you can't even trust copy and paste anymore... no idea how that > happened. Here's the missing part (so no, self is not missing): > > [...] > @pytest.mark.usefixtures('param2', 'param1a') > class TestClass(unittest.TestCase): > def test_method(self): > if self.param2[0] == 1: > assert self.param1a == 0 > else: > assert self.param1a == 7 > > Thanks, > -Nikolaus > > > "Florian Schulze" writes: >> Hi! >> >> You didn't include the test_method, maybe you just forgot the 'self' >> as first parameter? >> >> Regards, >> Florian Schulze >> >> >> On 10 Feb 2014, at 4:51, Nikolaus Rath wrote: >> >>> Hello, >>> >>> I don't understand why the following test fixture works for the test >>> function, but fails for the test method. Am I doing something wrong, >>> or >>> is this a bug? >>> >>> $ cat t0_mine.py >>> import pytest >>> import unittest >>> >>> @pytest.yield_fixture(params=(0,1,2)) >>> def param1(request): >>> if request.param == 1: >>> pytest.skip('not so good') >>> >>> yield request.param >>> >>> @pytest.fixture(params=('a','b')) >>> def param2(request, param1): >>> return (param1, request.param) >>> >>> @pytest.fixture() >>> def param1a(request, param1): >>> if param1 == 1: >>> return 0 >>> else: >>> return 7 >>> >>> def test_function(param2, param1a): >>> if param2[0] == 1: >>> assert param1a == 0 >>> else: >>> assert param1a == 7 >>> >>> @pytest.mark.usefixtures('param2', 'param1a') >>> >>> $ py.test-3 t0_mine.py -v >>> ==================================== test session starts >>> ==================================== >>> platform linux -- Python 3.3.3 -- pytest-2.5.1 -- /usr/bin/python3 >>> collected 7 items >>> >>> t0_mine.py:25: test_function[a-0] PASSED >>> t0_mine.py:25: test_function[a-1] SKIPPED >>> t0_mine.py:25: test_function[a-2] PASSED >>> t0_mine.py:25: test_function[b-0] PASSED >>> t0_mine.py:25: test_function[b-1] SKIPPED >>> t0_mine.py:25: test_function[b-2] PASSED >>> t0_mine.py:33: TestClass.test_method ERROR >>> >>> ========================================== ERRORS >>> =========================================== >>> __________________________ ERROR at setup of TestClass.test_method >>> __________________________ >>> >>> request = > >>> >>> @pytest.yield_fixture(params=(0,1,2)) >>> def param1(request): >>>> if request.param == 1: >>> E AttributeError: 'SubRequest' object has no attribute 'param' >>> >>> t0_mine.py:9: AttributeError >>> ======================= 4 passed, 2 skipped, 1 error in 0.02 seconds >>> ======================== >>> >>> >>> >>> Best, >>> Nikolaus >>> >>> >>> -- >>> Encrypted emails preferred. >>> PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C >>> >>> ?Time flies like an arrow, fruit flies like a Banana.? >>> _______________________________________________ >>> Pytest-dev mailing list >>> Pytest-dev at python.org >>> https://mail.python.org/mailman/listinfo/pytest-dev >> _______________________________________________ >> Pytest-dev mailing list >> Pytest-dev at python.org >> https://mail.python.org/mailman/listinfo/pytest-dev > > > -- > Encrypted emails preferred. > PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C > > ?Time flies like an arrow, fruit flies like a Banana.? > _______________________________________________ > Pytest-dev mailing list > Pytest-dev at python.org > https://mail.python.org/mailman/listinfo/pytest-dev -- Debian GNU/Linux -- The Power of Freedom www.debian.org | www.gnu.org | www.kernel.org From flub at devork.be Thu Feb 20 22:46:17 2014 From: flub at devork.be (Floris Bruynooghe) Date: Thu, 20 Feb 2014 21:46:17 +0000 Subject: [pytest-dev] py.test and decorators In-Reply-To: References: <20140123180814.GU22354@merlinux.eu> <20140123183008.GW22354@merlinux.eu> Message-ID: Hi Sarah, Apologies for not responding before, I wasn't really following this thread however Holger is away for a month hence the long silence I guess. I've used the zip and followed the instructions. As an example I've started with uncommenting testpoison and indeed as soon as uncommented py.test failed weirdly without any hint: while executing the test it just exited. I can't say exactly what is going on there and it probably is a bug that py.test just exists, but without narrowing it down it's hard to say why (and all the * imports make it hard to follow what's going on ;-)). However I assumed that this test was supposed to get a Channel instance from a fixture. Not finding any fixtures I changed the code to this: @pytest.fixture def chan(): return Channel() @process def testpoinson(chan): print('Sending termination event...') chan.poison() return And now running the tests works just fine. Having the @process decorator on the test function is a bit odd however and I'm not sure how this behaves. It's probably better to try writing tests without a decorator. E.g. the following worked as well and looks much more reasonable to me (I'm just guessing here on the csp stuff btw, maybe I'm doing silly things): @pytest.fixture def chan(): return Channel() def test_poinson(chan): @process def testpoison(chan): # chan = Channel() print('Sending termination event...') chan.poison() return ret = testpoison(chan) assert ret I don't really feel like I understand your problem, for example I feel like this test needs to assert something on the channel but I have no idea how/what (some process seems to be started anyway when I add ``print ret; assert 0``). But maybe this was enough to give you some inspiration of how to prod things to start making some progress again. Regards, Floris On 17 February 2014 09:16, Sarah Mount wrote: > Sorry to be a pain, I realise everyone here is a volunteer, but is there a > way to move this issue forward? I have quite a bit of work blocked on > getting py.test to work on my repo currently, and I'd rather use py.test > than any other framework. I'm more than happy to put in more effort to > narrow the bug down or take some of the next steps myself, but at this stage > I'm not really sure where to start... > > Thanks, > > Sarah > > > On Fri, Jan 24, 2014 at 9:35 AM, Sarah Mount wrote: >> >> On 1/23/14, holger krekel wrote: >> > On Thu, Jan 23, 2014 at 18:27 +0000, Sarah Mount wrote: >> >> The tests were completely ad-hoc and did not use unittest or any other >> >> library. They had a hand-rolled runner which ran all the functions like >> >> test_one_one from a script. >> >> >> >> The odd thing is that Python 2.7 + py.test + the functools.wraps >> >> version >> >> of >> >> the decorators worked OK. >> >> >> >> Could it be that I have inadvertently turned the logging module on and >> >> output from that is confusing the py.test runner? >> > >> > wouldn't think so. Can you attach a zip file and state the dependencies >> > so we can try to reproduce? Or a repo-url? >> > >> >> Many thanks, I am reluctant to give you a repo-url since there is so >> much code in there that is irrelevant to this issue it would be hard >> to figure out what is going on. >> >> The attached zip contains the minimum code to reproduce. If you run >> "show_bug.sh" from the pytest-bug directory this will: >> >> 1) install the requirements via pip, >> >> 2) run a single test from vanilla python (should pass), >> >> 3) run the same test with py.test (should green at this stage) and >> >> 4) display some text explaining what to uncomment to reproduce the bug. >> >> I have narrowed it down quite a bit, and it turns out that if you >> comment out most of the code in base.py everything works just fine... >> which is odd. >> >> Thanks for your help, >> >> Sarah >> >> -- >> Sarah Mount, Senior Lecturer, University of Wolverhampton >> website: http://www.snim2.org/ >> twitter: @snim2 > > > > > -- > Sarah Mount, Senior Lecturer, University of Wolverhampton > website: http://www.snim2.org/ > twitter: @snim2 > > _______________________________________________ > Pytest-dev mailing list > Pytest-dev at python.org > https://mail.python.org/mailman/listinfo/pytest-dev > -- Debian GNU/Linux -- The Power of Freedom www.debian.org | www.gnu.org | www.kernel.org From anton7811 at gmail.com Wed Feb 26 12:19:54 2014 From: anton7811 at gmail.com (Anton P) Date: Wed, 26 Feb 2014 13:19:54 +0200 Subject: [pytest-dev] Parametrized tests funcargs missing on 'pytest_collection_modifyitems' hook (pytest 2.5.2) Message-ID: Hi, For testing purposes I use hook 'pytest_collection_modifyitems' to get values of all arguments passed in parametrized test function, e.g.: *def pytest_collection_modifyitems(items):* * for item in items:* * print item.funcargs* with code execution example: *{'doc': ['doc_1'], 'name': 'test_1'}* *{'doc': ['doc_2'], 'name': 'test_2'}* *{'doc': ['doc_3'], 'name': 'test_3'}* Example of code usage is attached. It works fine with pytest version 2.4.2. However while moving to pytest version 2.5.2 i faced the following issue: *item.funcargs *dictionary is empty {} {} {} Could you please clarify how can I get *funcargs *in the 'pytest_collection_modifyitems' hook in pytest 2.5.2? Thanks in advance! Anton -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: conftest.py Type: text/x-python Size: 129 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test_marks.py Type: text/x-python Size: 259 bytes Desc: not available URL: From raghu at avninetworks.com Thu Feb 27 13:06:43 2014 From: raghu at avninetworks.com (Raghu Savalagi) Date: Thu, 27 Feb 2014 17:36:43 +0530 Subject: [pytest-dev] how to debug pytests using eclipse Message-ID: I need help in debugging pytests using eclipse. please help me. -------------- next part -------------- An HTML attachment was scrubbed... URL: From issues-reply at bitbucket.org Wed Feb 26 22:03:06 2014 From: issues-reply at bitbucket.org (jtriley) Date: Wed, 26 Feb 2014 21:03:06 -0000 Subject: [pytest-dev] Issue #8: pytest-cache plugin not loading when using setuptools integration (hpk42/pytest-cache) Message-ID: <20140226210306.17923.81751@app18.ash-private.bitbucket.org> New issue 8: pytest-cache plugin not loading when using setuptools integration https://bitbucket.org/hpk42/pytest-cache/issue/8/pytest-cache-plugin-not-loading-when-using jtriley: The pytest-cache plugin is not being loaded when using pytest's setuptools integration in the case that pytest-cache is not installed into site-packages. In this case pytest-cache gets downloaded and installed to a local egg in the current working directory by setuptools (due to `tests_require=["pytest-cov", "pytest-pep8", "pytest-flakes", "pytest"]`) and I get this error when running `python setup.py test`: ``` $ pip freeze | grep -i pytest # no output here (ie no pytest* in site-packages) $ python setup.py test running test Searching for pytest Reading https://pypi.python.org/simple/pytest/ Best match: pytest 2.5.2 Downloading https://pypi.python.org/packages/source/p/pytest/pytest-2.5.2.tar.gz#md5=8ea3d1939e81514ccba9ba0e9566b5be Processing pytest-2.5.2.tar.gz Writing /tmp/easy_install-odE70G/pytest-2.5.2/setup.cfg Running pytest-2.5.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-odE70G/pytest-2.5.2/egg-dist-tmp-EJlcV7 Installed /repos/starcluster/pytest-2.5.2-py2.6.egg Searching for pytest-flakes Reading https://pypi.python.org/simple/pytest-flakes/ Best match: pytest-flakes 0.2 Downloading https://pypi.python.org/packages/source/p/pytest-flakes/pytest-flakes-0.2.zip#md5=44b8f9746fcd827de5c02f14b01728c1 Processing pytest-flakes-0.2.zip Writing /tmp/easy_install-Va719z/pytest-flakes-0.2/setup.cfg Running pytest-flakes-0.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Va719z/pytest-flakes-0.2/egg-dist-tmp-6BG8vX zip_safe flag not set; analyzing archive contents... Installed /repos/starcluster/pytest_flakes-0.2-py2.6.egg Searching for pytest-pep8 Reading https://pypi.python.org/simple/pytest-pep8/ Best match: pytest-pep8 1.0.5 Downloading https://pypi.python.org/packages/source/p/pytest-pep8/pytest-pep8-1.0.5.tar.gz#md5=6199353734615fde47d1fbfef1ebc737 Processing pytest-pep8-1.0.5.tar.gz Writing /tmp/easy_install-XWWEl7/pytest-pep8-1.0.5/setup.cfg Running pytest-pep8-1.0.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-XWWEl7/pytest-pep8-1.0.5/egg-dist-tmp-yLvZVL warning: no directories found matching 'doc' warning: no directories found matching 'test_pep8.py' zip_safe flag not set; analyzing archive contents... Installed /repos/starcluster/pytest_pep8-1.0.5-py2.6.egg Searching for pytest-cov Reading https://pypi.python.org/simple/pytest-cov/ Best match: pytest-cov 1.6 Downloading https://pypi.python.org/packages/source/p/pytest-cov/pytest-cov-1.6.tar.gz#md5=6da54d74bde9d200de45068ba2ea637a Processing pytest-cov-1.6.tar.gz Writing /tmp/easy_install-KJqVFv/pytest-cov-1.6/setup.cfg Running pytest-cov-1.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-KJqVFv/pytest-cov-1.6/egg-dist-tmp-nVGVAM Installed /repos/starcluster/pytest_cov-1.6-py2.6.egg Searching for pytest-cache Reading https://pypi.python.org/simple/pytest-cache/ Best match: pytest-cache 1.0 Downloading https://pypi.python.org/packages/source/p/pytest-cache/pytest-cache-1.0.tar.gz#md5=e51ff62fec70a1fd456d975ce47977cd Processing pytest-cache-1.0.tar.gz Writing /tmp/easy_install-Rnm1YK/pytest-cache-1.0/setup.cfg Running pytest-cache-1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Rnm1YK/pytest-cache-1.0/egg-dist-tmp-Gorswt zip_safe flag not set; analyzing archive contents... Installed /repos/starcluster/pytest_cache-1.0-py2.6.egg running egg_info writing dependency_links to StarCluster.egg-info/dependency_links.txt writing requirements to StarCluster.egg-info/requires.txt writing StarCluster.egg-info/PKG-INFO writing top-level names to StarCluster.egg-info/top_level.txt writing entry points to StarCluster.egg-info/entry_points.txt reading manifest file 'StarCluster.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files found matching 'requirements.txt' writing manifest file 'StarCluster.egg-info/SOURCES.txt' running build_ext usage: setup.py [options] [file_or_dir] [file_or_dir] [...] setup.py: error: unrecognized arguments: --clearcache ``` If I then install pytest-cache into site-packages the plugin loads as expected: ``` $ rm -rf pytest_cache-1.0-py2.6.egg $ pip install pytest-cache $ python setup.py test running test running egg_info writing dependency_links to StarCluster.egg-info/dependency_links.txt writing requirements to StarCluster.egg-info/requires.txt writing StarCluster.egg-info/PKG-INFO writing top-level names to StarCluster.egg-info/top_level.txt writing entry points to StarCluster.egg-info/entry_points.txt reading manifest file 'StarCluster.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files found matching 'requirements.txt' writing manifest file 'StarCluster.egg-info/SOURCES.txt' running build_ext ========== test session starts ==================== platform linux2 -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 -- /home/user/.virtualenvs/starcluster/bin/python cachedir: /repos/starcluster/.cache plugins: flakes, pep8, cov, cache collected 272 items starcluster/__init__.py:0: PEP8-check PASSED ... ``` To fix this I've applied the following patch to PyTest's run_tests method in order to properly load the cache plugin: ``` class PyTest(TestCommand): ... def run_tests(self): import pytest import _pytest.config pm = _pytest.config.get_plugin_manager() pm.consider_setuptools_entrypoints() errno = pytest.main(self.test_args) sys.exit(errno) ``` Another approach is to simply import the pytest-cache plugin and pass it to pytest.main via the plugins kwarg. The pytest-cache plugin for my project gets pulled in by pytest-pep8. Interestingly if I install pytest and plugins (pytest-cov, pytest-cache, pytest-pep8, and pytest-flakes) to site-packages first and then `pip uninstall pytest-cache` then setuptools will download and install pytest-cache to the current working directory as an egg and the plugin gets loaded: ``` $ pip freeze | grep -i pytest # no pytest* packages installed $ pip install pytest pytest-{cov,pep8,flakes} <<< Downloading/unpacking pytest Using download cache from /home/user/.pip/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpytest%2Fpytest-2.5.2.tar.gz Running setup.py (path:/home/user/.virtualenvs/starcluster/build/pytest/setup.py) egg_info for package pytest Downloading/unpacking pytest-cov Using download cache from /home/user/.pip/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpytest-cov%2Fpytest-cov-1.6.tar.gz Running setup.py (path:/home/user/.virtualenvs/starcluster/build/pytest-cov/setup.py) egg_info for package pytest-cov Downloading/unpacking pytest-pep8 Using download cache from /home/user/.pip/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpytest-pep8%2Fpytest-pep8-1.0.5.tar.gz Running setup.py (path:/home/user/.virtualenvs/starcluster/build/pytest-pep8/setup.py) egg_info for package pytest-pep8 warning: no directories found matching 'doc' warning: no directories found matching 'test_pep8.py' Downloading/unpacking pytest-flakes Using download cache from /home/user/.pip/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpytest-flakes%2Fpytest-flakes-0.2.zip Running setup.py (path:/home/user/.virtualenvs/starcluster/build/pytest-flakes/setup.py) egg_info for package pytest-flakes Requirement already satisfied (use --upgrade to upgrade): py>=1.4.20 in /home/user/.virtualenvs/starcluster/lib/python2.6/site-packages (from pytest) Requirement already satisfied (use --upgrade to upgrade): argparse in /home/user/.virtualenvs/starcluster/lib/python2.6/site-packages (from pytest) Requirement already satisfied (use --upgrade to upgrade): cov-core>=1.6 in /home/user/.virtualenvs/starcluster/lib/python2.6/site-packages (from pytest-cov) Downloading/unpacking pytest-cache (from pytest-pep8) Using download cache from /home/user/.pip/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpytest-cache%2Fpytest-cache-1.0.tar.gz Running setup.py (path:/home/user/.virtualenvs/starcluster/build/pytest-cache/setup.py) egg_info for package pytest-cache Requirement already satisfied (use --upgrade to upgrade): pep8>=1.3 in /home/user/.virtualenvs/starcluster/lib/python2.6/site-packages (from pytest-pep8) Requirement already satisfied (use --upgrade to upgrade): pyflakes in /home/user/.virtualenvs/starcluster/lib/python2.6/site-packages (from pytest-flakes) Requirement already satisfied (use --upgrade to upgrade): coverage>=3.4 in /home/user/.virtualenvs/starcluster/lib/python2.6/site-packages (from cov-core>=1.6->pytest-cov) Requirement already satisfied (use --upgrade to upgrade): execnet>=1.1.dev1 in /home/user/.virtualenvs/starcluster/lib/python2.6/site-packages (from pytest-cache->pytest-pep8) Installing collected packages: pytest, pytest-cov, pytest-pep8, pytest-flakes, pytest-cache Running setup.py install for pytest Installing py.test script to /home/user/.virtualenvs/starcluster/bin Installing py.test-2.6 script to /home/user/.virtualenvs/starcluster/bin Running setup.py install for pytest-cov Running setup.py install for pytest-pep8 warning: no directories found matching 'doc' warning: no directories found matching 'test_pep8.py' Running setup.py install for pytest-flakes Running setup.py install for pytest-cache Successfully installed pytest pytest-cov pytest-pep8 pytest-flakes pytest-cache Cleaning up... $ pip uninstall pytest-cache Uninstalling pytest-cache: /home/user/.virtualenvs/starcluster/lib/python2.6/site-packages/pytest_cache-1.0-py2.6.egg-info /home/user/.virtualenvs/starcluster/lib/python2.6/site-packages/pytest_cache.py /home/user/.virtualenvs/starcluster/lib/python2.6/site-packages/pytest_cache.pyc Proceed (y/n)? y Successfully uninstalled pytest-cache $ python setup.py test running test Searching for pytest-cache Reading https://pypi.python.org/simple/pytest-cache/ Best match: pytest-cache 1.0 Downloading https://pypi.python.org/packages/source/p/pytest-cache/pytest-cache-1.0.tar.gz#md5=e51ff62fec70a1fd456d975ce47977cd Processing pytest-cache-1.0.tar.gz Writing /tmp/easy_install-VNYw5V/pytest-cache-1.0/setup.cfg Running pytest-cache-1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-VNYw5V/pytest-cache-1.0/egg-dist-tmp-8eoxLc zip_safe flag not set; analyzing archive contents... Installed /repos/starcluster/pytest_cache-1.0-py2.6.egg running egg_info writing dependency_links to StarCluster.egg-info/dependency_links.txt writing requirements to StarCluster.egg-info/requires.txt writing StarCluster.egg-info/PKG-INFO writing top-level names to StarCluster.egg-info/top_level.txt writing entry points to StarCluster.egg-info/entry_points.txt reading manifest file 'StarCluster.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files found matching 'requirements.txt' writing manifest file 'StarCluster.egg-info/SOURCES.txt' running build_ext =========== test session starts ========== platform linux2 -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2 -- /home/user/.virtualenvs/starcluster/bin/python cachedir: /repos/starcluster/.cache plugins: cache, cov, pep8, flakes collected 272 items starcluster/__init__.py:0: pyflakes-check PASSED starcluster/__init__.py:0: PEP8-check PASSED ... ``` So this may be some chicken and egg problem between pep8 and pyflakes installs. I'm happy to provide more details and/or move the issue to another tracker if the problem turns out to really be in the pytest-pep8 plugin.