Exemplo n.º 1
0
 def test_validateDirs_multibad(self):
     invalid0 = os.path.join(self.tempdir, 'unique', 'rabbit')
     invalid1 = os.path.join(self.tempdir, 'affable', 'elephant')
     with self.assertRaises(IOError) as ecm:
         scansourcedirs([invalid0, invalid1])
     e = ecm.exception
     self.assertTrue('affable/elephant' in e.filename)
Exemplo n.º 2
0
 def test_skipping_misnamed_singlefile(self):
     ex = random.choice(example.sources)
     maindir = 'LDP/LDP/howto'
     reldir, absdir = self.adddir(maindir)
     self.addfile(reldir, ex.filename, ext=".mis")
     s = scansourcedirs([absdir])
     self.assertEqual(1, len(s))
Exemplo n.º 3
0
 def test_finding_singlefile(self):
     ex = random.choice(example.sources)
     maindir = 'LDP/LDP/howto'
     reldir, absdir = self.adddir(maindir)
     _, _ = self.addfile(reldir, ex.filename)
     s = scansourcedirs([absdir])
     self.assertEqual(1, len(s))
Exemplo n.º 4
0
 def test_multiple_stems_of_different_extensions(self):
     ex = random.choice(example.sources)
     stem = 'A-Non-Unique-Stem'
     maindir = os.path.join('LDP/LDP/howto', stem)
     reldir, absdir = self.adddir(maindir)
     self.addfile(reldir, ex.filename, stem=stem, ext=".xml")
     self.addfile(reldir, ex.filename, stem=stem, ext=".md")
     s = scansourcedirs([absdir])
     self.assertEqual(1, len(s))
Exemplo n.º 5
0
 def test_multidir_finding_namecollision(self):
     ex = random.choice(example.sources)
     doc0 = Namespace(reldir='LDP/howto', stem="A-Non-Unique-Stem")
     doc1 = Namespace(reldir='LDP/guide', stem="A-Non-Unique-Stem")
     documents = (doc0, doc1)
     for d in documents:
         d.reldir, d.absdir = self.adddir(d.reldir)
         _, _ = self.addfile(d.reldir, ex.filename, stem=d.stem)
     s = scansourcedirs([x.absdir for x in documents])
     self.assertEqual(1, len(s))
     expected = set([x.stem for x in documents])
     found = set(s.keys())
     self.assertEqual(expected, found)
Exemplo n.º 6
0
 def test_finding_nonfile(self):
     maindir = 'LDP/LDP/howto'
     reldir, absdir = self.adddir(maindir)
     os.mkfifo(os.path.join(absdir, 'non-dir-non-file.xml'))
     s = scansourcedirs([absdir])
     self.assertEqual(0, len(s))
Exemplo n.º 7
0
 def testEmptyDir(self):
     s = scansourcedirs([self.tempdir])
     self.assertEqual(0, len(s))
Exemplo n.º 8
0
 def test_validateDirs_onebad(self):
     invalid0 = os.path.join(self.tempdir, 'unique', 'rabbit')
     with self.assertRaises(IOError) as ecm:
         scansourcedirs([invalid0])
     e = ecm.exception
     self.assertTrue('unique/rabbit' in e.filename)