Skip to content

Commit

Permalink
Fix some Windows tests
Browse files Browse the repository at this point in the history
* Remove any test (or part of a test) that references `find_module()`.
* Use assertIsNone() / assertIsNotNone() consistently.
  • Loading branch information
warsaw committed Apr 29, 2023
1 parent afd921a commit c1ab102
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions Lib/test/test_importlib/test_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,16 @@ class WindowsRegistryFinderTests:

def test_find_spec_missing(self):
spec = self.machinery.WindowsRegistryFinder.find_spec('spam')
self.assertIs(spec, None)

def test_find_module_missing(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module('spam')
self.assertIs(loader, None)
self.assertIsNone(spec)

def test_module_found(self):
with setup_module(self.machinery, self.test_module):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
self.assertIsNot(loader, None)
self.assertIsNot(spec, None)
self.assertIsNotNone(spec)

def test_module_not_found(self):
with setup_module(self.machinery, self.test_module, path="."):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
self.assertIsNone(loader)
self.assertIsNone(spec)

(Frozen_WindowsRegistryFinderTests,
Expand Down

0 comments on commit c1ab102

Please sign in to comment.