mirror of
https://github.com/github/codeql.git
synced 2025-12-16 08:43:11 +01:00
Tests can be run with ``` bazel test //swift/codegen:tests ``` Coverage can be checked installing `pytest-cov` and running ``` pytest --cov=swift/codegen swift/codegen/test ```
21 lines
582 B
Python
21 lines
582 B
Python
""" module providing useful filesystem paths """
|
|
|
|
import pathlib
|
|
import sys
|
|
import os
|
|
|
|
try:
|
|
_workspace_dir = pathlib.Path(os.environ['BUILD_WORKSPACE_DIRECTORY']).resolve() # <- means we are using bazel run
|
|
swift_dir = _workspace_dir / 'swift'
|
|
except KeyError:
|
|
_this_file = pathlib.Path(__file__).resolve()
|
|
swift_dir = _this_file.parents[2]
|
|
|
|
lib_dir = swift_dir / 'codegen' / 'lib'
|
|
templates_dir = lib_dir / 'templates'
|
|
|
|
try:
|
|
exe_file = pathlib.Path(sys.argv[0]).resolve().relative_to(swift_dir)
|
|
except ValueError:
|
|
exe_file = pathlib.Path(sys.argv[0]).name
|