Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6)

Side by Side Diff: Lib/test/test_import.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_http_cookiejar.py ('k') | Lib/test/test_imp.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import builtins 1 import builtins
2 import imp 2 import imp
3 from importlib.test.import_ import test_relative_imports 3 from importlib.test.import_ import test_relative_imports
4 from importlib.test.import_ import util as importlib_util 4 from importlib.test.import_ import util as importlib_util
5 import marshal 5 import marshal
6 import os 6 import os
7 import py_compile 7 import py_compile
8 import random 8 import random
9 import stat 9 import stat
10 import sys 10 import sys
11 import unittest 11 import unittest
12 import textwrap 12 import textwrap
13 13
14 from test.support import ( 14 from test.support import (
15 EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython, 15 EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython,
16 make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask, 16 make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask,
17 unlink, unload, create_empty_file) 17 unlink, unload)
18 from test import script_helper 18 from test import script_helper
19 19
20 20
21 def remove_files(name): 21 def remove_files(name):
22 for f in (name + ".py", 22 for f in (name + ".py",
23 name + ".pyc", 23 name + ".pyc",
24 name + ".pyo", 24 name + ".pyo",
25 name + ".pyw", 25 name + ".pyw",
26 name + "$py.class"): 26 name + "$py.class"):
27 unlink(f) 27 unlink(f)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 @unittest.skipUnless(os.name == 'posix', 97 @unittest.skipUnless(os.name == 'posix',
98 "test meaningful only on posix systems") 98 "test meaningful only on posix systems")
99 def test_execute_bit_not_copied(self): 99 def test_execute_bit_not_copied(self):
100 # Issue 6070: under posix .pyc files got their execute bit set if 100 # Issue 6070: under posix .pyc files got their execute bit set if
101 # the .py file had the execute bit set, but they aren't executable. 101 # the .py file had the execute bit set, but they aren't executable.
102 with temp_umask(0o022): 102 with temp_umask(0o022):
103 sys.path.insert(0, os.curdir) 103 sys.path.insert(0, os.curdir)
104 try: 104 try:
105 fname = TESTFN + os.extsep + "py" 105 fname = TESTFN + os.extsep + "py"
106 create_empty_file(fname) 106 open(fname, 'w').close()
107 os.chmod(fname, (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | 107 os.chmod(fname, (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH |
108 stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)) 108 stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH))
109 __import__(TESTFN) 109 __import__(TESTFN)
110 fn = imp.cache_from_source(fname) 110 fn = imp.cache_from_source(fname)
111 if not os.path.exists(fn): 111 if not os.path.exists(fn):
112 self.fail("__import__ did not result in creation of " 112 self.fail("__import__ did not result in creation of "
113 "either a .pyc or .pyo file") 113 "either a .pyc or .pyo file")
114 s = os.stat(fn) 114 s = os.stat(fn)
115 self.assertEqual( 115 self.assertEqual(
116 stat.S_IMODE(s.st_mode), 116 stat.S_IMODE(s.st_mode),
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 run_unittest(ImportTests, PycacheTests, 649 run_unittest(ImportTests, PycacheTests,
650 PycRewritingTests, PathsTests, RelativeImportTests, 650 PycRewritingTests, PathsTests, RelativeImportTests,
651 OverridingImportBuiltinTests, 651 OverridingImportBuiltinTests,
652 RelativeImportFromImportlibTests) 652 RelativeImportFromImportlibTests)
653 653
654 654
655 if __name__ == '__main__': 655 if __name__ == '__main__':
656 # Test needs to be a package, so we can do relative imports. 656 # Test needs to be a package, so we can do relative imports.
657 from test.test_import import test_main 657 from test.test_import import test_main
658 test_main() 658 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_http_cookiejar.py ('k') | Lib/test/test_imp.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+