Example #1
0
 def finalize(self, data, result):
     if self.enabled and data['result.success']:
         coverage = self.coverage()
         coverage.load()
         report = StringIO()
         coverage.report(file=report)
         report_string = report.getvalue()
         last_line = report_string.splitlines()[-1]
         match = re.match(r'TOTAL\s+(?P<stmts>\d+)\s+(?P<exec>\d+)\s+'
                          r'(?P<cover>\d+)%', last_line)
         if match:
             statements = int(match.group('stmts'))
             executed = int(match.group('exec'))
             percent_covered = int(match.group('cover'))
             if percent_covered == 100:
                 level = int(math.log(statements, 2) - 7)
                 data.unlock(self)
Example #2
0
 def finalize(self, data, result):
     if self.enabled and data['result.success']:
         coverage = self.coverage()
         coverage.load()
         report = StringIO()
         coverage.report(file=report)
         report_string = report.getvalue()
         last_line = report_string.splitlines()[-1]
         match = re.match(
             r'TOTAL\s+(?P<stmts>\d+)\s+(?P<exec>\d+)\s+'
             r'(?P<cover>\d+)%', last_line)
         if match:
             statements = int(match.group('stmts'))
             executed = int(match.group('exec'))
             percent_covered = int(match.group('cover'))
             if percent_covered == 100:
                 level = int(math.log(statements, 2) - 7)
                 data.unlock(self)
Example #3
0
    a = unittest.TextTestRunner(verbosity=2).run(alltests)

if coverage:
    coverage.stop()
else:
    print("Coverage module not found. Skipping coverage report.")

if not xml:
    print("\nResult", a)
if not a.wasSuccessful():
    sys.exit(1)

if coverage:
    all_sources = []

    def incl(d):
        for x in os.listdir(d):
            if x.endswith('.py'):
                all_sources.append(os.path.join(d, x))

    incl('../zeroinstall')
    incl('../zeroinstall/support')
    incl('../zeroinstall/cmd')
    incl('../zeroinstall/injector')
    incl('../zeroinstall/zerostore')
    all_sources += ['../0launch']
    if xml:
        coverage.xml_report(all_sources)
    else:
        coverage.report(all_sources)
Example #4
0
		assert f3 == [p4, p3]
		assert f4 == [p4]

	def test_user(self):
		# make valid nicknames
		n = User.make_valid_nickname('John_123')
		assert n == 'John_123'
		n = User.make_valid_nickname('John_[123]')
		assert n == 'John_123'
		# create a user
		u = User(nickname = 'john', email='*****@*****.**')
		db.session.add(u)
		db.session.commit()
		assert u.is_authenticated() is True
		assert u.is_active() is True
		assert u.is_anonymous() is False
		assert u.id == int(u.get_id())


if __name__ == '__main__':
	try:
		unittest.main() 
	except:
		pass
	coverage.stop()
	coverage.save()
	print("\nCoverage Report:\n")
	coverage.report()
	print("HTML version: " + os.path.join(basedir, "tmp/coverage/index.html"))
	coverage.html_report(directory="tmp/coverage")
	coverage.erase()
Example #5
0
    a = xmlrunner.XMLTestRunner(verbose=True).run(alltests)
else:
    a = unittest.TextTestRunner(verbosity=2).run(alltests)

if coverage:
	coverage.stop()
else:
	print("Coverage module not found. Skipping coverage report.")

if not xml:
    print("\nResult", a)
if not a.wasSuccessful():
	sys.exit(1)

if coverage:
	all_sources = []
	def incl(d):
		for x in os.listdir(d):
			if x.endswith('.py'):
				all_sources.append(os.path.join(d, x))
	incl('../zeroinstall')
	incl('../zeroinstall/support')
	incl('../zeroinstall/cmd')
	incl('../zeroinstall/injector')
	incl('../zeroinstall/zerostore')
	all_sources += ['../0launch']
	if xml:
		coverage.xml_report(all_sources)
	else:
		coverage.report(all_sources)