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

Make testCoberturaParser in cmdline.test work on Windows, or skip just this test #2663

Closed
gvanrossum opened this issue Jan 9, 2017 · 6 comments

Comments

@gvanrossum
Copy link
Member

gvanrossum commented Jan 9, 2017

When you run cmdline.test on Windows you get an error on testCoberturaParser.

  • When lxml is not installed this fails to find the expected output because this test is for the --cobertura-xml-report option which requires lxml, and such options are silently ignored when lxml is not installed.
  • When lxml is installed this fails because the expected output contains some UNIX-specific filenames.

We currently deal with this by skipping all "cmdline" tests in our Windows appveyor.yml, but that's sub-optimal because it means that the command line flags are not tested at all there.

We can either delete the test (but then the feature will probably rot without anyone noticing), or move it to a separate category that is skipped on Windows only (which is more work).

@alexandrul
Copy link
Contributor

If it's ok to use some kind of a flag to signal that the test suite is executed under windows, it could be as easy as replacing \ with / for the relative file path in CoberturaXmlReporter.on_file

@gvanrossum
Copy link
Member Author

Detecting Windows is easy enough (sys.platform == "win32"). It's perhaps a little bit weird to normalize paths to using forward / on Windows, but all in all I think it's a reasonable compromise, so let's give it a try.

@alexandrul
Copy link
Contributor

True, but I don't see a reason to use linux path sep under windows for usual operations.
I would make this change only for the tests, to keep the expected output unchanged.

How can I detect that the code is called as part of the tests?

@gvanrossum
Copy link
Member Author

gvanrossum commented Feb 5, 2017 via email

@alexandrul
Copy link
Contributor

I've got it working. I have opened #2814 for adding lxml on AppVeyor (and running the reports tests), next step would be the PR for this fix.

@alexandrul
Copy link
Contributor

Just opened #2815

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

No branches or pull requests

2 participants