FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docsbuild-scripts/tests/test_build_docs.py at main · python/docsbuild-scripts · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
python
/
docsbuild-scripts
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
68
Star
84
Code
Issues
8
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
docsbuild-scripts
/
tests
/
test_build_docs.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (40 loc) · 1.32 KB
Breadcrumbs
docsbuild-scripts
/
tests
/
test_build_docs.py
Copy path
File metadata and controls
48 lines (40 loc) · 1.32 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
47
48
from
unittest
.
mock
import
patch
import
pytest
from
build_docs
import
Version
,
Versions
,
build_robots_txt
,
format_seconds
@
pytest
.
mark
.
parametrize
(
(
"seconds"
,
"expected"
),
[
(
0.4
,
"0s"
),
(
0.5
,
"0s"
),
(
0.6
,
"1s"
),
(
1.5
,
"2s"
),
(
30
,
"30s"
),
(
60
,
"1m 0s"
),
(
185
,
"3m 5s"
),
(
454
,
"7m 34s"
),
(
7456
,
"2h 4m 16s"
),
(
30.1
,
"30s"
),
(
60.2
,
"1m 0s"
),
(
185.3
,
"3m 5s"
),
(
454.4
,
"7m 34s"
),
(
7456.5
,
"2h 4m 16s"
),
],
)
def
test_format_seconds
(
seconds
:
float
,
expected
:
str
)
->
None
:
assert
format_seconds
(
seconds
)
==
expected
@
patch
(
"build_docs.chgrp"
)
def
test_build_robots_txt
(
mock_chgrp
,
tmp_path
)
->
None
:
versions
=
Versions
([
Version
(
name
=
"3.14"
,
status
=
"EOL"
,
branch_or_tag
=
"3.14"
),
Version
(
name
=
"3.15"
,
status
=
"EOL"
,
branch_or_tag
=
"3.15"
),
Version
(
name
=
"3.16"
,
status
=
"security-fixes"
,
branch_or_tag
=
"3.16"
),
Version
(
name
=
"3.17"
,
status
=
"stable"
,
branch_or_tag
=
"2.17"
),
])
build_robots_txt
(
versions
,
tmp_path
,
group
=
""
,
skip_cache_invalidation
=
True
,
http
=
None
)
result
=
(
tmp_path
/
"robots.txt"
).
read_text
()
assert
"Disallow: /3.14/"
in
result
assert
"Disallow: /3.15/"
in
result
assert
"/3.16/"
not
in
result
assert
"/3.17/"
not
in
result
Back
|
FazBrowse Home
|
New Git URL