From 965af75cc48eac5494bdf1d4aac6df43834c853a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Tue, 5 Jan 2021 09:41:26 +0000 Subject: Requirement files support within deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/tox/tox_env/api.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/tox/tox_env/api.py') 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 @@ -282,6 +278,18 @@ class ToxEnv(ABC): if self.journal and execute_status.outcome is not None: 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: -- cgit v1.2.1