Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

TypeError: %d format: a number is required, not NoneType #14

Closed
guettli opened this Issue Jul 14, 2014 · 2 comments

Comments

Projects
None yet
2 participants

guettli commented Jul 14, 2014

I get this exception.

Versions:
pytest==2.5.2
pytest-cov==1.7.0
Python 2.7.3

Please tell me, if you need further information to solve this.

Thank you

Traceback (most recent call last):
  File "/localhome/foo_vums_dtg/bin/py.test", line 9, in <module>
    load_entry_point('pytest==2.5.2', 'console_scripts', 'py.test')()
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/config.py", line 20, in main
    return config.hook.pytest_cmdline_main(config=config)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/core.py", line 377, in __call__
    return self._docall(methods, kwargs)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/core.py", line 388, in _docall
    res = mc.execute()
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/core.py", line 289, in execute
    res = method(**kwargs)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/main.py", line 112, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/main.py", line 105, in wrap_session
    exitstatus=session.exitstatus)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/core.py", line 377, in __call__
    return self._docall(methods, kwargs)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/core.py", line 388, in _docall
    res = mc.execute()
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/core.py", line 289, in execute
    res = method(**kwargs)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/terminal.py", line 338, in pytest_sessionfinish
    self.config.hook.pytest_terminal_summary(terminalreporter=self)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/core.py", line 377, in __call__
    return self._docall(methods, kwargs)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/core.py", line 388, in _docall
    res = mc.execute()
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/_pytest/core.py", line 289, in execute
    res = method(**kwargs)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/pytest_cov.py", line 130, in pytest_terminal_summary
    self.cov_controller.summary(terminalreporter._tw)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/cov_core.py", line 166, in summary
    CovController.summary(self, stream)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/cov_core.py", line 123, in summary
    self.cov.html_report(ignore_errors=True)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/coverage/control.py", line 662, in html_report
    return reporter.report(morfs)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/coverage/html.py", line 113, in report
    self.report_files(self.html_file, morfs, self.config.html_dir)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/coverage/report.py", line 84, in report_files
    report_fn(cu, self.coverage._analyze(cu))
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/coverage/control.py", line 592, in _analyze
    return Analysis(self, it)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/coverage/results.py", line 24, in __init__
    self.statements, self.excluded = self.parser.parse_source()
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/coverage/parser.py", line 210, in parse_source
    self._raw_parse()
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/coverage/parser.py", line 167, in _raw_parse
    self.statement_starts.update(self.byte_parser._find_statements())
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/coverage/parser.py", line 73, in _get_byte_parser
    ByteParser(text=self.text, filename=self.filename)
  File "/localhome/foo_vums_dtg/local/lib/python2.7/site-packages/coverage/parser.py", line 354, in __init__
    (filename, synerr.msg, synerr.lineno)
TypeError: %d format: a number is required, not NoneType
foo_vums_dtg@berry:~$ 
Contributor

schlamar commented Jul 14, 2014

Could it be that you are testing against a *.pyc file? In such a case coverage fails because it cannot read line numbers from the tested code.

Otherwise I would need a reproducible test case.

@schlamar schlamar added the feedback label Jul 16, 2014

guettli commented Aug 4, 2014

Yes, I was testing agains a pyc file with no corresponding py file.

@schlamar schlamar added invalid and removed feedback labels Aug 15, 2014

@schlamar schlamar closed this Aug 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment