FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-gitlab/tests/smoke/test_dists.py at v7.1.0 · python-gitlab/python-gitlab · GitHub
python-gitlab
python-gitlab
Repository navigation
Code
Issues
16
(16)
Pull requests
15
(15)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-gitlab
/
tests
/
smoke
/
test_dists.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (34 loc) · 1.48 KB
Breadcrumbs
python-gitlab
/
tests
/
smoke
/
test_dists.py
Copy path
File metadata and controls
47 lines (34 loc) · 1.48 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
import
subprocess
import
sys
import
tarfile
import
zipfile
from
pathlib
import
Path
import
pytest
from
gitlab
.
_version
import
__title__
,
__version__
DOCS_DIR
=
"docs"
TEST_DIR
=
"tests"
DIST_NORMALIZED_TITLE
=
f"
{
__title__
.
replace
(
'-'
,
'_'
)
}
-
{
__version__
}
"
SDIST_FILE
=
f"
{
DIST_NORMALIZED_TITLE
}
.tar.gz"
WHEEL_FILE
=
f"
{
DIST_NORMALIZED_TITLE
}
-py
{
sys
.
version_info
.
major
}
-none-any.whl"
PY_TYPED
=
"gitlab/py.typed"
@
pytest
.
fixture
(
scope
=
"session"
)
def
build
(
tmp_path_factory
:
pytest
.
TempPathFactory
):
temp_dir
=
tmp_path_factory
.
mktemp
(
"build"
)
subprocess
.
run
([
sys
.
executable
,
"-m"
,
"build"
,
"--outdir"
,
temp_dir
],
check
=
True
)
return
temp_dir
def
test_sdist_includes_correct_files
(
build
:
Path
)
->
None
:
sdist
=
tarfile
.
open
(
build
/
SDIST_FILE
,
"r:gz"
)
docs_dir
=
sdist
.
getmember
(
f"
{
DIST_NORMALIZED_TITLE
}
/
{
DOCS_DIR
}
"
)
test_dir
=
sdist
.
getmember
(
f"
{
DIST_NORMALIZED_TITLE
}
/
{
TEST_DIR
}
"
)
readme
=
sdist
.
getmember
(
f"
{
DIST_NORMALIZED_TITLE
}
/README.rst"
)
py_typed
=
sdist
.
getmember
(
f"
{
DIST_NORMALIZED_TITLE
}
/
{
PY_TYPED
}
"
)
assert
docs_dir
.
isdir
()
assert
test_dir
.
isdir
()
assert
py_typed
.
isfile
()
assert
readme
.
isfile
()
def
test_wheel_includes_correct_files
(
build
:
Path
)
->
None
:
wheel
=
zipfile
.
ZipFile
(
build
/
WHEEL_FILE
)
assert
PY_TYPED
in
wheel
.
namelist
()
def
test_wheel_excludes_docs_and_tests
(
build
:
Path
)
->
None
:
wheel
=
zipfile
.
ZipFile
(
build
/
WHEEL_FILE
)
assert
not
any
(
file
.
startswith
((
DOCS_DIR
,
TEST_DIR
))
for
file
in
wheel
.
namelist
())
Back
|
FazBrowse Home
|
New Git URL