Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ flask
fastapi
uvicorn
django
testresources
testscenarios
testtools

# Integrated TensorBoard tests
tensorboard
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import os

import testresources
from testscenarios import generate_scenarios

def load_tests(loader, tests, pattern):
this_dir = os.path.dirname(__file__)
mytests = loader.discover(start_dir=this_dir, pattern=pattern)
result = testresources.OptimisingTestSuite()
result.addTests(generate_scenarios(mytests))
result.addTests(generate_scenarios(tests))
return result
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

from testscenarios import TestWithScenarios
import unittest

from testscenarios import TestWithScenarios, generate_scenarios


def load_tests(loader, standard_tests, pattern): # noqa: ARG001
# Pre-expand ``TestWithScenarios`` scenarios at load time so individual
# scenario-multiplied test IDs (e.g. ``test_operations(add)``) can be
# resolved by ``unittest.TestLoader.loadTestsFromName``. Without this,
# ``TestWithScenarios`` only multiplies scenarios at ``run()`` time and
# loading a specific scenario by name raises ``AttributeError``.
result = unittest.TestSuite()
result.addTests(generate_scenarios(standard_tests))
return result


class TestMathOperations(TestWithScenarios):
scenarios = [
('add', {'test_id': 'test_add', 'a': 5, 'b': 3, 'expected': 8}),
('subtract', {'test_id': 'test_subtract', 'a': 5, 'b': 3, 'expected': 2}),
('multiply', {'test_id': 'test_multiply', 'a': 5, 'b': 3, 'expected': 15})
('multiply', {'test_id': 'test_multiply', 'a': 5, 'b': 3, 'expected': 15}),
]
a: int = 0
b: int = 0
Expand Down
Loading