Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
bbb68a8b
Commit
bbb68a8b
authored
Jan 02, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite test using pytest.
parent
b14ed9cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
26 deletions
+20
-26
setuptools/tests/fixtures.py
setuptools/tests/fixtures.py
+7
-0
setuptools/tests/test_egg_info.py
setuptools/tests/test_egg_info.py
+13
-26
No files found.
setuptools/tests/fixtures.py
View file @
bbb68a8b
...
...
@@ -3,6 +3,7 @@ import pytest
from
.
import
contexts
@
pytest
.
yield_fixture
def
user_override
():
"""
...
...
@@ -15,3 +16,9 @@ def user_override():
with
mock
.
patch
(
'site.USER_SITE'
,
user_site
):
with
contexts
.
save_user_site_setting
():
yield
@
pytest
.
yield_fixture
def
tmpdir_cwd
(
tmpdir
):
with
tmpdir
.
as_cwd
()
as
orig
:
yield
orig
setuptools/tests/test_egg_info.py
View file @
bbb68a8b
...
...
@@ -2,22 +2,11 @@ import os
import
tempfile
import
shutil
import
stat
import
unittest
from
.
import
environment
class
TestEggInfo
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
test_dir
=
tempfile
.
mkdtemp
()
self
.
old_cwd
=
os
.
getcwd
()
os
.
chdir
(
self
.
test_dir
)
def
tearDown
(
self
):
os
.
chdir
(
self
.
old_cwd
)
shutil
.
rmtree
(
self
.
test_dir
)
class
TestEggInfo
:
def
_create_project
(
self
):
with
open
(
'setup.py'
,
'w'
)
as
f
:
...
...
@@ -33,7 +22,7 @@ class TestEggInfo(unittest.TestCase):
f
.
write
(
'def run():
\
n
'
)
f
.
write
(
" print('hello')
\
n
"
)
def
test_egg_base_installed_egg_info
(
self
):
def
test_egg_base_installed_egg_info
(
self
,
tmpdir_cwd
):
self
.
_create_project
()
temp_dir
=
tempfile
.
mkdtemp
(
prefix
=
'setuptools-test.'
)
os
.
chmod
(
temp_dir
,
stat
.
S_IRWXU
)
...
...
@@ -54,7 +43,7 @@ class TestEggInfo(unittest.TestCase):
'--install-lib'
,
paths
[
'lib'
],
'--install-scripts'
,
paths
[
'scripts'
],
'--install-data'
,
paths
[
'data'
]],
pypath
=
os
.
pathsep
.
join
([
paths
[
'lib'
],
s
elf
.
old_cwd
]),
pypath
=
os
.
pathsep
.
join
([
paths
[
'lib'
],
s
tr
(
tmpdir_cwd
)
]),
data_stream
=
1
,
env
=
environ
)
if
code
:
...
...
@@ -63,17 +52,15 @@ class TestEggInfo(unittest.TestCase):
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
paths
[
'lib'
]):
if
os
.
path
.
basename
(
dirpath
)
==
'EGG-INFO'
:
egg_info
=
sorted
(
filenames
)
self
.
assertEqual
(
egg_info
,
[
'PKG-INFO'
,
'SOURCES.txt'
,
'dependency_links.txt'
,
'entry_points.txt'
,
'not-zip-safe'
,
'top_level.txt'
])
expected
=
[
'PKG-INFO'
,
'SOURCES.txt'
,
'dependency_links.txt'
,
'entry_points.txt'
,
'not-zip-safe'
,
'top_level.txt'
,
]
assert
egg_info
==
expected
finally
:
shutil
.
rmtree
(
temp_dir
)
def
test_suite
():
return
unittest
.
defaultTestLoader
.
loadTestsFromName
(
__name__
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment