File tree 1 file changed +31
-1
lines changed
1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
3
3
import logging
4
+ import os
4
5
5
6
import pytest
6
7
11
12
logger = logging .getLogger (__name__ )
12
13
13
14
15
+ @pytest .fixture (autouse = True )
16
+ def clear_env (monkeypatch ):
17
+ """Clear out any unnecessary environment variables that could interrupt tests.
18
+
19
+ tmux show-environment tests were being interrupted due to a lot of crazy env vars.
20
+ """
21
+ for k , v in os .environ .items ():
22
+ if not any (
23
+ needle in k .lower ()
24
+ for needle in [
25
+ 'window' ,
26
+ 'tmux' ,
27
+ 'pane' ,
28
+ 'session' ,
29
+ 'pytest' ,
30
+ 'path' ,
31
+ 'pwd' ,
32
+ 'shell' ,
33
+ 'home' ,
34
+ 'xdg' ,
35
+ 'disable_auto_title' ,
36
+ 'lang' ,
37
+ 'term' ,
38
+ ]
39
+ ):
40
+ monkeypatch .delenv (k )
41
+
42
+
14
43
@pytest .fixture (scope = 'function' )
15
- def server (request ):
44
+ def server (request , monkeypatch ):
45
+
16
46
t = Server ()
17
47
t .socket_name = 'tmuxp_test%s' % next (namer )
18
48
You can’t perform that action at this time.
0 commit comments