Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e9ac6535
Commit
e9ac6535
authored
Nov 25, 2011
by
Meador Inge
Browse files
Options
Browse Files
Download
Plain Diff
Issue #12618: create unit tests for the py_compile module
parents
06f78165
9b03b658
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
Lib/test/test_py_compile.py
Lib/test/test_py_compile.py
+42
-0
No files found.
Lib/test/test_py_compile.py
0 → 100644
View file @
e9ac6535
import
imp
import
os
import
py_compile
import
shutil
import
tempfile
import
unittest
from
test
import
support
,
script_helper
class
PyCompileTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
directory
=
tempfile
.
mkdtemp
()
self
.
source_path
=
os
.
path
.
join
(
self
.
directory
,
'_test.py'
)
self
.
pyc_path
=
self
.
source_path
+
'c'
self
.
cache_path
=
imp
.
cache_from_source
(
self
.
source_path
)
with
open
(
self
.
source_path
,
'w'
)
as
file
:
file
.
write
(
'x = 123
\
n
'
)
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
directory
)
def
test_absolute_path
(
self
):
py_compile
.
compile
(
self
.
source_path
,
self
.
pyc_path
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
pyc_path
))
self
.
assertFalse
(
os
.
path
.
exists
(
self
.
cache_path
))
def
test_cache_path
(
self
):
py_compile
.
compile
(
self
.
source_path
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
cache_path
))
def
test_relative_path
(
self
):
py_compile
.
compile
(
os
.
path
.
relpath
(
self
.
source_path
),
os
.
path
.
relpath
(
self
.
pyc_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
pyc_path
))
self
.
assertFalse
(
os
.
path
.
exists
(
self
.
cache_path
))
def
test_main
():
support
.
run_unittest
(
PyCompileTests
)
if
__name__
==
"__main__"
:
test_main
()
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