def test_path_from_caller_file():
    path = Path.from_caller_file()
    assert path == __file__

    dot = os.path.abspath('.')
    caller_files = [m.path_caller_file for m in _get_example_modules()]
    assert caller_files == [
        os.path.join(dot, 'tests', 'ex_module_2.py'),
        os.path.join(dot, 'tests', 'ex_package_1', '__init__.py'),
        os.path.join(dot, 'tests', 'ex_package_1', 'ex_module_1.py'),
        os.path.join(dot, 'tests', 'ex_package_1', 'ex_package_2',
                     '__init__.py'),
        os.path.join(dot, 'tests', 'ex_package_1', 'ex_package_2',
                     'ex_module_1.py'),
    ]
示例#2
0
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019~2999 - Cologler <*****@*****.**>
# ----------
# a module use for test Path.from_caller_? api
# ----------

from fsoopify import Path

path_caller_file = Path.from_caller_file()
path_caller_module_root = Path.from_caller_module_root()