File: conftest.py

package info (click to toggle)
python-docutils 0.22%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 11,448 kB
  • sloc: python: 53,302; lisp: 14,475; xml: 1,807; javascript: 1,032; makefile: 102; sh: 96
file content (28 lines) | stat: -rw-r--r-- 860 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def pytest_report_header(config):
    import os
    import pathlib
    import platform
    import sys
    import time

    # get metadata of the local `docutils` package
    docutils_root = pathlib.Path(__file__).resolve().parents[1] / 'docutils'
    namespace = {}
    exec((docutils_root/'__init__.py').read_text(encoding='utf-8'), namespace)

    return '\n'.join((
        '',
        f'Testing Docutils {namespace["__version__"]} '
        f'with Python {sys.version.split()[0]} '
        f'on {time.strftime("%Y-%m-%d at %H:%M:%S")}',
        f'OS: {platform.system()} {platform.release()} {platform.version()} '
        f'({sys.platform}, {platform.platform()})',
        f'Working directory: {os.getcwd()}',
        f'Docutils package: {docutils_root}',
        '',
    ))


# self-test
if __name__ == '__main__':
    print(pytest_report_header(None))