SF.net SVN: docutils:[9801 ] trunk/docutils/test/allte sts.py

aa-turner--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9801
          http://sourceforge.net/p/docutils/code/9801
Author:   aa-turner
Date:     2024-07-31 10:01:41 +0000 (Wed, 31 Jul 2024)
Log Message:
-----------
Ignore global setup when reporting elapsed time

This isn't really that useful given that tests run
in around three seconds. To find elapsed time, use
time python alltests.py.

Modified Paths:
--------------
    trunk/docutils/test/alltests.py

Modified: trunk/docutils/test/alltests.py
===================================================================
--- trunk/docutils/test/alltests.py	2024-07-31 09:56:18 UTC (rev 9800)
+++ trunk/docutils/test/alltests.py	2024-07-31 10:01:41 UTC (rev 9801)
@@ -14,25 +14,19 @@
 are run.
 """
 
+import atexit
+import platform
 import time
-# Start point for actual elapsed time, including imports
-# and setup outside of unittest.
-start = time.time()
+import sys
+from pathlib import Path
+from typing import TYPE_CHECKING
 
-import atexit               # noqa: E402
-import os                   # noqa: E402
-from pathlib import Path    # noqa: E402
-import platform             # noqa: E402
-import sys                  # noqa: E402
-from typing import TYPE_CHECKING  # noqa: E402
-
-
 # Prepend the "docutils root" to the Python library path
 # so we import the local `docutils` package.
 DOCUTILS_ROOT = Path(__file__).resolve().parents[1]
 sys.path.insert(0, str(DOCUTILS_ROOT))
 
-import docutils             # noqa: E402
+import docutils  # NoQA: E402
 
 if TYPE_CHECKING:
     import types
@@ -98,6 +92,8 @@
 
 
 if __name__ == '__main__':
+    # Start point for elapsed time, except suite setup.
+    start = time.time()
     suite = unittest.defaultTestLoader.discover(str(DOCUTILS_ROOT / 'test'))
     print(f'Testing Docutils {docutils.__version__} '
           f'with Python {sys.version.split()[0]} '
@@ -104,8 +100,8 @@
           f'on {time.strftime("%Y-%m-%d at %H:%M:%S")}')
     print(f'OS: {platform.system()} {platform.release()} {platform.version()} '
           f'({sys.platform}, {platform.platform()})')
-    print(f'Working directory: {os.getcwd()}')
-    print(f'Docutils package: {os.path.dirname(docutils.__file__)}')
+    print(f'Working directory: {Path.cwd()}')
+    print(f'Docutils package: {Path(docutils.__file__).parent}')
     sys.stdout.flush()
     result = unittest.TextTestRunner(resultclass=NumbersTestResult).run(suite)
     finish = time.time()

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.