================
@@ -0,0 +1,283 @@
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+# To run these tests:
+# python3 check-alphabetical-order_test.py -v
+
+import io
+import os
+import tempfile
+import unittest
+from contextlib import redirect_stderr
+import importlib.util
+import importlib.machinery
+from typing import Any, cast
+
+
+def _load_script_module():
+    here = os.path.dirname(cast(str, __file__))
+    script_path = os.path.normpath(os.path.join(here, 
"check-alphabetical-order.py"))
+    loader = importlib.machinery.SourceFileLoader(
+        "check_alphabetical_order", cast(str, script_path)
+    )
+    spec = importlib.util.spec_from_loader(loader.name, loader)
+    if spec is None or spec.loader is None:
+        raise ImportError(f"Failed to load spec for {script_path}")
+    mod = importlib.util.module_from_spec(spec)
+    spec.loader.exec_module(mod)
+    return mod
----------------
vbvictor wrote:

This is all needed because you can't import `-`-delimeted script name?
Lets rename it `check_alphabetical_order.py` and then just `import 
check_alphabetical_order`

https://github.com/llvm/llvm-project/pull/166072
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to