FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-devtools/tests/test_utils.py at main · kinuax/python-devtools · GitHub
kinuax
/
python-devtools
Public
forked from
samuelcolvin/python-devtools
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-devtools
/
tests
/
test_utils.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (31 loc) · 1.49 KB
Breadcrumbs
python-devtools
/
tests
/
test_utils.py
Copy path
File metadata and controls
46 lines (31 loc) · 1.49 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import
sys
import
pytest
import
devtools
.
utils
from
devtools
.
utils
import
env_bool
,
env_true
,
use_highlight
def
test_env_true
():
assert
env_true
(
'PATH'
)
is
False
assert
env_true
(
'DOES_NOT_EXIST'
)
is
None
def
test_env_bool
(
monkeypatch
):
assert
env_bool
(
False
,
'VAR'
,
None
)
is
False
monkeypatch
.
delenv
(
'TEST_VARIABLE_NOT_EXIST'
,
raising
=
False
)
assert
env_bool
(
None
,
'TEST_VARIABLE_NOT_EXIST'
,
True
)
is
True
monkeypatch
.
setenv
(
'TEST_VARIABLE_EXIST'
,
'bar'
)
assert
env_bool
(
None
,
'TEST_VARIABLE_EXIST'
,
True
)
is
False
def
test_use_highlight_manually_set
(
monkeypatch
):
monkeypatch
.
delenv
(
'TEST_DONT_USE_HIGHLIGHT'
,
raising
=
False
)
assert
use_highlight
(
highlight
=
True
)
is
True
assert
use_highlight
(
highlight
=
False
)
is
False
monkeypatch
.
setenv
(
'PY_DEVTOOLS_HIGHLIGHT'
,
'True'
)
assert
use_highlight
()
is
True
monkeypatch
.
setenv
(
'PY_DEVTOOLS_HIGHLIGHT'
,
'False'
)
assert
use_highlight
()
is
False
@
pytest
.
mark
.
skipif
(
sys
.
platform
==
'win32'
,
reason
=
'windows os'
)
def
test_use_highlight_auto_not_win
(
monkeypatch
):
monkeypatch
.
delenv
(
'TEST_DONT_USE_HIGHLIGHT'
,
raising
=
False
)
monkeypatch
.
setattr
(
devtools
.
utils
,
'isatty'
,
lambda
_
=
None
:
True
)
assert
use_highlight
()
is
True
@
pytest
.
mark
.
skipif
(
sys
.
platform
!=
'win32'
,
reason
=
'not windows os'
)
def
test_use_highlight_auto_win
(
monkeypatch
):
monkeypatch
.
delenv
(
'TEST_DONT_USE_HIGHLIGHT'
,
raising
=
False
)
monkeypatch
.
setattr
(
devtools
.
utils
,
'isatty'
,
lambda
_
=
None
:
True
)
assert
use_highlight
()
is
True
Back
|
FazBrowse Home
|
New Git URL