summaryrefslogtreecommitdiff
path: root/setuptools/_vendor/importlib_resources/tests/_compat.py
blob: e7bf06dd4eb5c1c65255df6262fec8332bdc9e2a (plain)
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
29
30
31
32
import os


try:
    from test.support import import_helper  # type: ignore
except ImportError:
    # Python 3.9 and earlier
    class import_helper:  # type: ignore
        from test.support import (
            modules_setup,
            modules_cleanup,
            DirsOnSysPath,
            CleanImport,
        )


try:
    from test.support import os_helper  # type: ignore
except ImportError:
    # Python 3.9 compat
    class os_helper:  # type:ignore
        from test.support import temp_dir


try:
    # Python 3.10
    from test.support.os_helper import unlink
except ImportError:
    from test.support import unlink as _unlink

    def unlink(target):
        return _unlink(os.fspath(target))