Failure generating html reports when the file name exceeds 260 characters (windows) · Issue #627 · nedbat/coveragepy (original) (raw)

Failure generating html reports when the file name exceeds 260 characters (MS Source)

Traceback (most recent call last):
  File "manage.py", line 86, in <module>
    main()
  File "manage.py", line 74, in main
    execute_from_command_line(sys.argv)
  File "manage.py", line 28, in __exit__
    self.cov.stop()
  File "G:\Program\PycharmProjects\project.fabricadigital.produto.instanet\web\cgi\Python2.7\lib\site-packages\coverage\control.py", line 1090, in html_report
    return reporter.report(morfs)
  File "G:\Program\PycharmProjects\project.fabricadigital.produto.instanet\web\cgi\Python2.7\lib\site-packages\coverage\html.py", line 139, in report
    self.report_files(self.html_file, morfs, self.config.html_dir)
  File "G:\Program\PycharmProjects\project.fabricadigital.produto.instanet\web\cgi\Python2.7\lib\site-packages\coverage\report.py", line 91, in report_files
    report_fn(fr, self.coverage._analyze(fr))
  File "G:\Program\PycharmProjects\project.fabricadigital.produto.instanet\web\cgi\Python2.7\lib\site-packages\coverage\html.py", line 286, in html_file
    write_html(html_path, html)
  File "G:\Program\PycharmProjects\project.fabricadigital.produto.instanet\web\cgi\Python2.7\lib\site-packages\coverage\html.py", line 69, in write_html
    with open(fname, "wb") as fout:
IOError: [Errno 2] No such file or directory: u'G:\\Program\\PycharmProjects\\project.fabricadigital.produto.instanet\\tmp\\testcover\\_Program_PycharmProjects_project_fabricadigital_produto_instanet_plugins_system_br_com_fabricadigital_plus_action_publique_content_plus_action_publique_content_action_register_py.html

With this is a django project, not all apps are at the root of the project. It has several apps out of the Django project structure. With that the final report ends up generating those names too big. Limiting the file path to 260 characters at most solves the problem.