Skip to content

Commit

Permalink
Merge b671f62 into 9e9e5cf
Browse files Browse the repository at this point in the history
  • Loading branch information
eltoder committed Apr 11, 2024
2 parents 9e9e5cf + b671f62 commit 9bf9851
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion green/result.py
Expand Up @@ -329,8 +329,8 @@ def startTest(self, test: RunnableTestT) -> None:
Called before each test runs.
"""
test = proto_test(test)
self.start_time = time.time()
self.reinitialize()
self.start_time = time.time()
if self.start_callback:
self.start_callback(test)

Expand Down
10 changes: 6 additions & 4 deletions green/test/test_process.py
Expand Up @@ -103,10 +103,12 @@ def testPass(self):
)
fh.close()
module_name = basename + ".test_pool_runner_dotted.A.testPass"
result = Queue()
poolRunner(module_name, result, 1)
result.get()
self.assertEqual(len(result.get().passing), 1)
results = Queue()
poolRunner(module_name, results, 1)
results.get()
result = results.get()
self.assertEqual(len(result.passing), 1)
self.assertGreater(float(result.test_time), 0)

def test_SyntaxErrorInUnitTest(self):
"""
Expand Down
10 changes: 10 additions & 0 deletions green/test/test_result.py
Expand Up @@ -104,6 +104,16 @@ def test_displayStderr(self):


class TestProtoTestResult(unittest.TestCase):
def test_startStop(self):
"""
startTest/stopTest work correctly
"""
ptr = ProtoTestResult()
test = proto_test(MagicMock())
ptr.startTest(test)
ptr.stopTest(test)
self.assertGreater(float(ptr.test_time), 0)

def test_addSuccess(self):
"""
addSuccess adds a test correctly
Expand Down

0 comments on commit 9bf9851

Please sign in to comment.