3
3
import logging
4
4
import os
5
5
import sys
6
+ from typing import Any
6
7
from unittest .mock import patch
7
8
8
9
import pytest
@@ -47,6 +48,14 @@ def tox_before_run_commands(tox_env: ToxEnv) -> None:
47
48
assert isinstance (tox_env , ToxEnv )
48
49
logging .warning ("tox_before_run_commands" )
49
50
51
+ @impl
52
+ def tox_on_install (tox_env : ToxEnv , arguments : Any , section : str , of_type : str ) -> None :
53
+ assert isinstance (tox_env , ToxEnv )
54
+ assert arguments is not None
55
+ assert isinstance (section , str )
56
+ assert isinstance (of_type , str )
57
+ logging .warning (f"tox_on_install { section } { of_type } " )
58
+
50
59
@impl
51
60
def tox_after_run_commands (tox_env : ToxEnv , exit_code : int , outcomes : list [Outcome ]) -> None :
52
61
assert isinstance (tox_env , ToxEnv )
@@ -55,8 +64,13 @@ def tox_after_run_commands(tox_env: ToxEnv, exit_code: int, outcomes: list[Outco
55
64
assert all (isinstance (i , Outcome ) for i in outcomes )
56
65
logging .warning ("tox_after_run_commands" )
57
66
67
+ @impl
68
+ def tox_env_teardown (tox_env : ToxEnv ) -> None :
69
+ assert isinstance (tox_env , ToxEnv )
70
+ logging .warning ("teardown" )
71
+
58
72
plugins = tuple (v for v in locals ().values () if callable (v ) and hasattr (v , "tox_impl" ))
59
- assert len (plugins ) == 6
73
+ assert len (plugins ) == 8
60
74
register_inline_plugin (mocker , * plugins )
61
75
project = tox_project ({"tox.ini" : "[testenv]\n package=skip\n commands=python -c 'print(1)'" })
62
76
result = project .run ("r" , "-e" , "a,b" )
@@ -68,15 +82,19 @@ def tox_after_run_commands(tox_env: ToxEnv, exit_code: int, outcomes: list[Outco
68
82
"ROOT: tox_add_core_config" ,
69
83
"a: tox_add_env_config" ,
70
84
"b: tox_add_env_config" ,
85
+ "a: tox_on_install PythonRun deps" ,
71
86
"a: tox_before_run_commands" ,
72
87
f"a: commands[0]> python -c { cmd } " ,
73
88
mocker .ANY , # output a
74
89
"a: tox_after_run_commands" ,
90
+ "a: teardown" ,
75
91
mocker .ANY , # report finished A
92
+ "b: tox_on_install PythonRun deps" ,
76
93
"b: tox_before_run_commands" ,
77
94
f"b: commands[0]> python -c { cmd } " ,
78
95
mocker .ANY , # output b
79
96
"b: tox_after_run_commands" ,
97
+ "b: teardown" ,
80
98
mocker .ANY , # report a
81
99
mocker .ANY , # report b
82
100
mocker .ANY , # overall report
0 commit comments