Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running tests in more environments #84

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions setuptools_git_versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from pprint import pformat
from typing import TYPE_CHECKING, Any, Callable

# because we use distutils in this file, we need to ensure that setuptools is
# imported first so that it can do monkey patching. this is not always already
# done for us, for example, when running this in a test or as a module
import setuptools # noqa: F401

if TYPE_CHECKING:
# avoid importing 'packaging' because setuptools-git-versioning can be installed using sdist
# where 'packaging' is not installed yet
Expand Down
7 changes: 7 additions & 0 deletions tests/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ def rand_sha() -> str:

def execute(cwd: str | os.PathLike, cmd: str, **kwargs) -> str:
log.info(f"Executing '{cmd}' at '{cwd}'")

if "env" in kwargs:
kwargs["env"]["PATH"] = os.environ["PATH"]
pythonpath = os.getenv("PYTHONPATH", None)
if pythonpath:
kwargs["env"]["PYTHONPATH"] = pythonpath

return subprocess.check_output(cmd, cwd=cwd, shell=True, universal_newlines=True, **kwargs) # nosec


Expand Down