File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 10
10
11
11
from pip import __version__
12
12
from pip ._internal .models .link import Link
13
- from pip ._internal .network .session import CI_ENVIRONMENT_VARIABLES , PipSession
13
+ from pip ._internal .network .session import (
14
+ CI_ENVIRONMENT_VARIABLES ,
15
+ PipSession ,
16
+ user_agent ,
17
+ )
14
18
15
19
16
20
def get_user_agent () -> str :
21
+ # These tests are testing the computation of the user agent, so we want to
22
+ # avoid reusing cached values.
23
+ user_agent .cache_clear ()
17
24
return PipSession ().headers ["User-Agent" ]
18
25
19
26
@@ -58,7 +65,7 @@ def test_user_agent__ci(
58
65
59
66
def test_user_agent_user_data (monkeypatch : pytest .MonkeyPatch ) -> None :
60
67
monkeypatch .setenv ("PIP_USER_AGENT_USER_DATA" , "some_string" )
61
- assert "some_string" in PipSession (). headers [ "User-Agent" ]
68
+ assert "some_string" in get_user_agent ()
62
69
63
70
64
71
class TestPipSession :
You can’t perform that action at this time.
0 commit comments