Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure generating html reports when the file name exceeds 260 characters (windows) #627

Closed
nedbat opened this issue Jan 5, 2018 · 2 comments
Labels
bug Something isn't working html

Comments

@nedbat
Copy link
Owner

nedbat commented Jan 5, 2018

Originally reported by alex (Bitbucket: alexssb, GitHub: alexssb)


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.


@nedbat
Copy link
Owner Author

nedbat commented Jan 20, 2018

Don't ever create HTML filenames longer than ~200 chars. Fixes #627.

→ <<cset 5617994ba64e (bb)>>

@nedbat
Copy link
Owner Author

nedbat commented Feb 3, 2018

This was included in coverage.py v4.5, released today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working html
Projects
None yet
Development

No branches or pull requests

1 participant