Skip to content

Commit

Permalink
tests: modulegraph: remove test_load_tail
Browse files Browse the repository at this point in the history
fn no longer exists
  • Loading branch information
xoviat committed Apr 5, 2021
1 parent edc41d1 commit ba1af40
Showing 1 changed file with 0 additions and 65 deletions.
65 changes: 0 additions & 65 deletions tests/unit/test_modulegraph/test_modulegraph.py
Expand Up @@ -699,71 +699,6 @@ def test_determine_parent(self):
def test_find_head_package(self):
self.fail("find_head_package")

def test_load_tail(self):
# XXX: This test is dodgy!

class MockedModuleGraph(modulegraph.ModuleGraph):
def _safe_import_module(self, partname, fqname, parent):
record.append((partname, fqname, parent))
if partname == 'raises' or '.raises.' in fqname:
# FIXME: original _load_tail returned a MissingModule if
# _import_module did return None. PyInstaller changed this
# in cae47e4f5b51a94ac3ceb5d093283ba0cc895589
return self.createNode(modulegraph.MissingModule, fqname)
return modulegraph.Node(fqname)

graph = MockedModuleGraph()

record = []
root = modulegraph.Node('root')
m = graph._load_tail(root, '')
self.assertTrue(m is root)
self.assertEqual(record, [
])

record = []
root = modulegraph.Node('root')
m = graph._load_tail(root, 'sub')
self.assertFalse(m is root)
self.assertEqual(record, [
('sub', 'root.sub', root),
])

record = []
root = modulegraph.Node('root')
m = graph._load_tail(root, 'sub.sub1')
self.assertFalse(m is root)
node = modulegraph.Node('root.sub')
self.assertEqual(record, [
('sub', 'root.sub', root),
('sub1', 'root.sub.sub1', node),
])

record = []
root = modulegraph.Node('root')
m = graph._load_tail(root, 'sub.sub1.sub2')
self.assertFalse(m is root)
node = modulegraph.Node('root.sub')
node2 = modulegraph.Node('root.sub.sub1')
self.assertEqual(record, [
('sub', 'root.sub', root),
('sub1', 'root.sub.sub1', node),
('sub2', 'root.sub.sub1.sub2', node2),
])

n = graph._load_tail(root, 'raises')
self.assertIsInstance(n, modulegraph.MissingModule)
self.assertEqual(n.identifier, 'root.raises')

n = graph._load_tail(root, 'sub.raises')
self.assertIsInstance(n, modulegraph.MissingModule)
self.assertEqual(n.identifier, 'root.sub.raises')

n = graph._load_tail(root, 'sub.raises.sub')
self.assertIsInstance(n, modulegraph.MissingModule)
self.assertEqual(n.identifier, 'root.sub.raises.sub')



@expectedFailure
def test_ensure_fromlist(self):
Expand Down

0 comments on commit ba1af40

Please sign in to comment.