diff options
author | Bernát Gábor <bgabor8@bloomberg.net> | 2021-01-05 09:41:26 +0000 |
---|---|---|
committer | Bernát Gábor <bgabor8@bloomberg.net> | 2021-01-07 09:24:24 +0000 |
commit | 965af75cc48eac5494bdf1d4aac6df43834c853a (patch) | |
tree | f8bd045da2db36b242635a0b078109147edd11e2 /src/tox/tox_env/api.py | |
parent | f91a685d1bfc057634c5fd62c225a976706e552f (diff) | |
download | tox-git-965af75cc48eac5494bdf1d4aac6df43834c853a.tar.gz |
Requirement files support within deps
To support -r/-c/etc within deps we consider the deps section itself a
requirements file. We forward this as such to the installer. We validate
and traverse the entries within the requirements file, build the keys
so we know when we need to rebuild the tox environment. If only add
operation has been observed do not recreate the environment, bur rather
just update it with a new requirement file install.
Also added a mechanism into tox.pytest that allows enabling a short
circuit into the execute API. This is useful for example to auto
pass all install steps with success and a noop.
All install steps now have a run id starting with install. Run ids
have been altered to use the _ over the - as separator. This is to
bring it inline with how the PEP-517 backend uses the function name as
run it, and as such uses the _ as separator.
Fold legacy dev build requires package install into install-deps from a
dedicated step.
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
Diffstat (limited to 'src/tox/tox_env/api.py')
-rw-r--r-- | src/tox/tox_env/api.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/tox/tox_env/api.py b/src/tox/tox_env/api.py index f6674ab1..677574b6 100644 --- a/src/tox/tox_env/api.py +++ b/src/tox/tox_env/api.py @@ -253,7 +253,7 @@ class ToxEnv(ABC): cwd = self.core["tox_root"] if show is None: show = self.options.verbosity > 3 - request = ExecuteRequest(cmd, cwd, self.environment_variables, stdin) + request = ExecuteRequest(cmd, cwd, self.environment_variables, stdin, run_id) if _CWD == request.cwd: repr_cwd = "" else: @@ -265,11 +265,7 @@ class ToxEnv(ABC): out_err = self.log_handler.stdout, self.log_handler.stderr if executor is None: executor = self.executor - with executor.call( - request=request, - show=show, - out_err=out_err, - ) as execute_status: + with self._execute_call(executor, out_err, request, show) as execute_status: execute_id = id(execute_status) try: self._execute_statuses[execute_id] = execute_status @@ -283,6 +279,18 @@ class ToxEnv(ABC): self.journal.add_execute(execute_status.outcome, run_id) @staticmethod + @contextmanager + def _execute_call( + executor: Execute, out_err: OutErr, request: ExecuteRequest, show: bool + ) -> Iterator[ExecuteStatus]: + with executor.call( + request=request, + show=show, + out_err=out_err, + ) as execute_status: + yield execute_status + + @staticmethod @abstractmethod def id() -> str: raise NotImplementedError |