コード例 #1
0
 def test_time(self):
     now = time.time()
     t = TestResult('test')
     time.sleep(1)
     t.finish('PASS')
     duration = time.time() - now
     self.assertTrue(math.fabs(duration - t.duration) < 1)
コード例 #2
0
ファイル: test.py プロジェクト: Wafflespeanut/gecko-dev
 def test_time(self):
     now = time.time()
     t = TestResult('test')
     time.sleep(1)
     t.finish('PASS')
     duration = time.time() - now
     self.assertTrue(math.fabs(duration - t.duration) < 1)
コード例 #3
0
ファイル: test.py プロジェクト: Floflis/gecko-b2g
    def setUp(self):
        c1 = TestContext("host1")
        c2 = TestContext("host2")
        c3 = TestContext("host2")
        c4 = TestContext("host1")

        t1 = TestResult("t1", context=c1)
        t2 = TestResult("t2", context=c2)
        t3 = TestResult("t3", context=c3)
        t4 = TestResult("t4", context=c4)

        self.collection = TestResultCollection("tests")
        self.collection.extend([t1, t2, t3, t4])
コード例 #4
0
    def setUp(self):
        c1 = TestContext('host1')
        c2 = TestContext('host2')
        c3 = TestContext('host2')
        c4 = TestContext('host1')

        t1 = TestResult('t1', context=c1)
        t2 = TestResult('t2', context=c2)
        t3 = TestResult('t3', context=c3)
        t4 = TestResult('t4', context=c4)

        self.collection = TestResultCollection('tests')
        self.collection.extend([t1, t2, t3, t4])
コード例 #5
0
    def post_to_autolog(self, results, name):
        from moztest.results import TestContext, TestResult, TestResultCollection
        from moztest.output.autolog import AutologOutput

        context = TestContext(
            testgroup='b2g xpcshell testsuite',
            operating_system='android',
            arch='emulator',
            harness='xpcshell',
            hostname=socket.gethostname(),
            tree='b2g',
            buildtype='opt',
        )

        collection = TestResultCollection('b2g emulator testsuite')

        for result in results:
            duration = result.get('time', 0)

            if 'skipped' in result:
                outcome = 'SKIPPED'
            elif 'todo' in result:
                outcome = 'KNOWN-FAIL'
            elif result['passed']:
                outcome = 'PASS'
            else:
                outcome = 'UNEXPECTED-FAIL'

            output = None
            if 'failure' in result:
                output = result['failure']['text']

            t = TestResult(name=result['name'],
                           test_class=name,
                           time_start=0,
                           context=context)
            t.finish(result=outcome, time_end=duration, output=output)

            collection.append(t)
            collection.time_taken += duration

        out = AutologOutput()
        out.post(out.make_testgroups(collection))
コード例 #6
0
  def post_to_autolog(self, results, name):
    from moztest.results import TestContext, TestResult, TestResultCollection
    from moztest.output.autolog import AutologOutput

    context = TestContext(
        testgroup='b2g xpcshell testsuite',
        operating_system='android',
        arch='emulator',
        harness='xpcshell',
        hostname=socket.gethostname(),
        tree='b2g',
        buildtype='opt',
        )

    collection = TestResultCollection('b2g emulator testsuite')

    for result in results:
      duration = result.get('time', 0)

      if 'skipped' in result:
        outcome = 'SKIPPED'
      elif 'todo' in result:
        outcome = 'KNOWN-FAIL'
      elif result['passed']:
        outcome = 'PASS'
      else:
        outcome = 'UNEXPECTED-FAIL'

      output = None
      if 'failure' in result:
        output = result['failure']['text']

      t = TestResult(name=result['name'], test_class=name,
                     time_start=0, context=context)
      t.finish(result=outcome, time_end=duration, output=output)

      collection.append(t)
      collection.time_taken += duration

    out = AutologOutput()
    out.post(out.make_testgroups(collection))
コード例 #7
0
    def post_to_autolog(self, results, name):
        from moztest.results import TestContext, TestResult, TestResultCollection
        from moztest.output.autolog import AutologOutput

        context = TestContext(
            testgroup="b2g xpcshell testsuite",
            operating_system="android",
            arch="emulator",
            harness="xpcshell",
            hostname=socket.gethostname(),
            tree="b2g",
            buildtype="opt",
        )

        collection = TestResultCollection("b2g emulator testsuite")

        for result in results:
            duration = result.get("time", 0)

            if "skipped" in result:
                outcome = "SKIPPED"
            elif "todo" in result:
                outcome = "KNOWN-FAIL"
            elif result["passed"]:
                outcome = "PASS"
            else:
                outcome = "UNEXPECTED-FAIL"

            output = None
            if "failure" in result:
                output = result["failure"]["text"]

            t = TestResult(name=result["name"], test_class=name, time_start=0, context=context)
            t.finish(result=outcome, time_end=duration, output=output)

            collection.append(t)
            collection.time_taken += duration

        out = AutologOutput()
        out.post(out.make_testgroups(collection))
コード例 #8
0
ファイル: runtests.py プロジェクト: JDaniel1990/gaia
 def __init__(self, *args, **kwargs):
     self.debug = kwargs.pop("debug", dict())
     TestResult.__init__(self, *args, **kwargs)
コード例 #9
0
ファイル: runtests.py プロジェクト: starnight/gaia
 def __init__(self, *args, **kwargs):
     self.debug = kwargs.pop('debug', dict())
     TestResult.__init__(self, *args, **kwargs)
コード例 #10
0
ファイル: test.py プロジェクト: Wafflespeanut/gecko-dev
 def test_custom_time(self):
     t = TestResult('test', time_start=0)
     t.finish(result='PASS', time_end=1000)
     self.assertEqual(t.duration, 1000)
コード例 #11
0
ファイル: test.py プロジェクト: Wafflespeanut/gecko-dev
 def test_results(self):
     self.assertRaises(AssertionError,
                       lambda: TestResult('test', result_expected='hello'))
     t = TestResult('test')
     self.assertRaises(ValueError, lambda: t.finish(result='good bye'))
コード例 #12
0
 def test_custom_time(self):
     t = TestResult('test', time_start=0)
     t.finish(result='PASS', time_end=1000)
     self.assertEqual(t.duration, 1000)
コード例 #13
0
 def test_results(self):
     self.assertRaises(AssertionError,
                       lambda: TestResult('test', result_expected='hello'))
     t = TestResult('test')
     self.assertRaises(ValueError, lambda: t.finish(result='good bye'))
コード例 #14
0
ファイル: test.py プロジェクト: ThinkerYzu/mozbase
 def test_successful(self):
     t = TestResult("test", result_expected="KNOWN-FAIL")
     t.finish(result="KNOWN-FAIL")
     self.assertTrue(t.successful)
コード例 #15
0
ファイル: test.py プロジェクト: ThinkerYzu/mozbase
 def test_results(self):
     self.assertRaises(AssertionError, lambda: TestResult("test", result_expected="hello"))
     t = TestResult("test")
     self.assertRaises(AssertionError, lambda: t.finish(result="good bye"))
コード例 #16
0
ファイル: test.py プロジェクト: Floflis/gecko-b2g
 def test_results(self):
     self.assertRaises(AssertionError,
                       lambda: TestResult("test", result_expected="hello"))
     t = TestResult("test")
     self.assertRaises(ValueError, lambda: t.finish(result="good bye"))