Пример #1
0
 def test_missing_bin_coverage(self):
     bindir = os.path.join(self.tempdir, 'bin')
     testbinary = os.path.join(bindir, 'test')
     os.mkdir(bindir)
     open(testbinary, 'w').write('hello')
     script.main()
     self.assertTrue('Executed coverage run' in executed[0])
Пример #2
0
 def test_test_args(self):
     bindir = os.path.join(self.tempdir, 'bin')
     testbinary = os.path.join(bindir, 'test')
     coveragebinary = os.path.join(bindir, 'coverage')
     os.mkdir(bindir)
     open(testbinary, 'w').write('hello')
     open(coveragebinary, 'w').write('hello')
     sys.argv[1:] = ['-t', '-m dummy']
     script.main()
     self.assertTrue('bin/coverage run' in executed[0])
     self.assertTrue('{} -m dummy'.format(testbinary) in executed[0])
Пример #3
0
 def test_normal_run(self):
     bindir = os.path.join(self.tempdir, 'bin')
     testbinary = os.path.join(bindir, 'test')
     coveragebinary = os.path.join(bindir, 'coverage')
     os.mkdir(bindir)
     open(testbinary, 'w').write('hello')
     open(coveragebinary, 'w').write('hello')
     script.main()
     self.assertTrue('bin/coverage run' in executed[0])
     self.assertTrue(
         'bin/coverage html --directory=htmlcov' in executed[1])
     self.assertTrue('Opened' in executed[2])
     script.main()
Пример #4
0
 def test_options(self):
     bindir = os.path.join(self.tempdir, 'bin')
     testbinary = os.path.join(bindir, 'test')
     coveragebinary = os.path.join(bindir, 'coverage')
     os.mkdir(bindir)
     open(testbinary, 'w').write('hello')
     open(coveragebinary, 'w').write('hello')
     sys.argv[1:] = ['-v', '-d', 'output']
     script.main()
     self.assertTrue('bin/coverage run' in executed[0])
     self.assertTrue(
         'bin/coverage html --directory=output' in executed[1])
     self.assertTrue(len(executed), 1)  # No "opened in webbrowser"!
     script.main()