def test_tracks_xfail(self): plugin.tracker = mock.Mock() location = ('test_file.py', 1, 'TestFake.test_me') user_properties = [('test_yaml', 'An example YAML string')] report = mock.Mock(when='call', outcome='skipped', location=location, wasxfail='', user_properties=user_properties) plugin.pytest_runtest_logreport(report) plugin.tracker.add_skip.assert_called_once_with( 'test_file.py', 'test_file.py::TestFake.test_me', '')
def test_path_pytest(self): plugin.tracker = mock.Mock() location = ('tests/test_file.py', 1, 'TestFake.test_me') user_properties = [('test_yaml', 'An example YAML string')] report = mock.Mock(when='call', outcome='passed', location=location, user_properties=user_properties) plugin.pytest_runtest_logreport(report) plugin.tracker.add_ok.assert_called_once_with( 'tests/test_file.py', 'tests/test_file.py::TestFake.test_me', directive='An example YAML string')
def test_track_when_call_report(self): """Only the call reports are tracked.""" plugin.tracker = mock.Mock() report = mock.Mock(when='setup', outcome='passed') plugin.pytest_runtest_logreport(report) self.assertFalse(plugin.tracker.add_ok.called)