def test_example_distribution_minus_x(self): self.source.ensure("sub", "conftest.py").write(py.code.Source(""" dist_hosts = ['localhost:%s'] """ % self.dest)) self.source.ensure("sub", "__init__.py") self.source.ensure("sub", "test_one.py").write(py.code.Source(""" def test_1(): pass def test_x(): import py py.test.skip("aaa") def test_2(): assert 0 def test_3(): raise ValueError(23) def test_4(someargs): pass """)) config = py.test.config._reparse([self.source.join("sub"), '-x']) rsession = RSession(config) allevents = [] rsession.main(reporter=allevents.append) testevents = [x for x in allevents if isinstance(x, repevent.ReceivedItemOutcome)] assert len(testevents) == 3 assert rsession.checkfun()