Skip to content
Open
Changes from 1 commit
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
13 changes: 12 additions & 1 deletion test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,22 @@ def retrieve_test_list(config_file=f"{PARENT_DIR}/.buildkite/test_description.js
default=False,
help="List available tests",
)
parser.add_argument(
"tests",
nargs="*",
help="The tests to run. If none are specified run all the available tests.",
)
args = parser.parse_args()

test_config = retrieve_test_list()

for test in test_config["tests"]:
name = test["test_name"]

if len(args.tests) > 0:
if name not in args.tests:
continue

command = test["command"]
command = command.replace("{target_platform}", platform.machine())
if args.list_tests:
Expand All @@ -66,4 +76,5 @@ def retrieve_test_list(config_file=f"{PARENT_DIR}/.buildkite/test_description.js
setattr(TestsContainer, f"test_{name}", test_func)

if not args.list_tests:
unittest.main(verbosity=2)
tests_suite = unittest.TestLoader().loadTestsFromTestCase(TestsContainer)
unittest.TextTestRunner(verbosity=2).run(tests_suite)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Why is the if + continue not enough above?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun story - I'm not sure. I was running into weird errors where it was erroring out and I couldn't figure out why. I had a chat (http://ix.io/4API) with gpt4 which suggested the change which worked. It's reasoning might be off but it seemed to imply that the unittests had already been parsed meaning the updated attributes didn't take effect. However I don't understand the guts of the unit test framework enough. The loading of the tests_suite seemed sane though.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not fully understand why it worked before and no longer does... The GPT explanation does not make sense to me, since the class starts off empty in both cases.

Maybe this is a bit easier?: https://paste.centos.org/view/8c66c3ef. Not sure if the __name__ assignment is a lot better though...