8000 bpo-37529: Add test for guessing extensions by akulakov · Pull Request #28243 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-37529: Add test for guessing extensions #28243

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

Merged

Conversation

akulakov
Copy link
Contributor
@akulakov akulakov commented Sep 8, 2021

Note that this test is for duplicated extensions, in which case guess_extension() returns None, so it's enough to test for this returned value for all known mime types.

Skipping on windows because there windows adds mime types from its registry and that creates some duplicates; I don't have windows system available so I can't determine which types get duplicated or how many.

https://bugs.python.org/issue37529

@akulakov akulakov requested a review from a team as a code owner September 8, 2021 21:20
8000
@bedevere-bot bedevere-bot added awaiting review tests Tests in the Lib/test dir labels Sep 8, 2021
@@ -150,6 +150,13 @@ def test_init_reinitializes(self):
# Poison should be gone.
self.assertEqual(mimetypes.guess_extension('foo/bar'), None)

@unittest.skipIf(sys.platform.startswith("win"), "Non-Windows only")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why non-Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On windows there is a test failure because windows seems to add mime types from its registry and that creates some duplicates; I don't have windows system available so I can't determine which types get duplicated or how many.

However it seems sufficient to test this on non-windows systems because the goal of the test is to check all of the types in the dictionary here:

types_map = _types_map_default = {

  • all of these would be tested on non-windows systems (or even on one specific non windows system).

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Oct 13, 2021
Copy link
Contributor
@MaxwellDupre MaxwellDupre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran 21 tests in 0.016s

OK (skipped=2)

== Tests result: SUCCESS ==

@asvetlov asvetlov changed the title bpo-37529: add test for guessing extensions bpo-37529: Add test for guessing extensions Mar 12, 2022
@asvetlov
Copy link
Contributor

Thanks!

@akulakov
Copy link
Contributor Author

Thank you @MaxwellDupre and @asvetlov !

@akulakov akulakov deleted the 37529-Add-unit-test-guessing-extensions branch March 12, 2022 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news stale Stale PR or inactive for long period of time. tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0