def check_skipped(self, args, reason): """Run check_coverage.py and make sure it's skipped.""" argv = [sys.argv[0]] + list(args) self._monkeypatch.setattr(check_coverage.sys, 'argv', argv) with pytest.raises(check_coverage.Skipped) as excinfo: check_coverage.check(None, perfect_files=[]) assert excinfo.value.reason == reason
def check_skipped(self, args, reason): """Run check_coverage.py and make sure it's skipped.""" argv = [sys.argv[0]] + list(args) self._monkeypatch.setattr(check_coverage.sys, 'argv', argv) with pytest.raises(check_coverage.Skipped) as excinfo: return check_coverage.check(None, perfect_files=[]) assert excinfo.value.reason == reason
def check(self, perfect_files=None): """Run check_coverage.py and run its return value.""" coverage_file = self._testdir.tmpdir / 'coverage.xml' if perfect_files is None: perfect_files = [(None, 'module.py')] argv = [sys.argv[0]] self._monkeypatch.setattr(check_coverage.sys, 'argv', argv) with self._testdir.tmpdir.as_cwd(): with coverage_file.open(encoding='utf-8') as f: return check_coverage.check(f, perfect_files=perfect_files)