From d789b22b93164879c67df89d8b171d26f5a281a9 Mon Sep 17 00:00:00 2001 From: Marcus Ottosson Date: Thu, 14 Dec 2023 16:19:14 +0000 Subject: [PATCH] Repair docs tests --- build_livedocs.py | 15 ++++++++++----- run_tests.py | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/build_livedocs.py b/build_livedocs.py index aa9f699..1c17284 100644 --- a/build_livedocs.py +++ b/build_livedocs.py @@ -108,11 +108,6 @@ def test_{count}_{header}(): import os import sys -# For nose -import collections -if not hasattr(collections, "Callable"): - collections.Callable = collections.abc.Callable - import nose from nose.tools import assert_raises @@ -121,6 +116,11 @@ def test_{count}_{header}(): from maya import standalone standalone.initialize() + # For nose + if sys.version_info[0] == 3: + import collections + collections.Callable = collections.abc.Callable + from maya import cmds import cmdx @@ -133,6 +133,11 @@ def test_{count}_{header}(): ]) result = nose.main(argv=argv, exit=False) + + if os.name == "nt": + # Graceful exit, only Windows seems to like this consistently + standalone.uninitialize() + os._exit(0 if result.success else 1) """) f.write("".join(tests)) diff --git a/run_tests.py b/run_tests.py index 8d53284..09c7624 100644 --- a/run_tests.py +++ b/run_tests.py @@ -6,8 +6,8 @@ import flaky.flaky_nose_plugin as flaky # For nose -import collections -if not hasattr(collections, "Callable"): +if sys.version_info[0] == 3: + import collections collections.Callable = collections.abc.Callable