Commit Graph

56 Commits

Author SHA1 Message Date
Ezio Melotti e5e7a7cbf4 #11420: merge with 3.2. 2013-03-16 21:49:20 +02:00
Ezio Melotti c28f6fa505 #11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters. 2013-03-16 19:48:51 +02:00
Brett Cannon 848cdfdf97 Issue #15828: Don't try to close a file if imp.find_module() doesn't
return one.
2012-08-31 11:31:20 -04:00
Nick Coghlan 91b9f139bc Issue #15828: Restore support for C extension modules in imp.load_module() 2012-09-01 00:13:45 +10:00
Brett Cannon 19a2f5961c Issue #15056: imp.cache_from_source() and source_from_cache() raise
NotimplementedError when sys.implementation.cache_tag is None.

Thanks to Pranav Ravichandran for taking an initial stab at the patch.
2012-07-09 13:58:07 -04:00
Antoine Pitrou 06e37587ff Try to further debug occasional buildbot failure 2012-06-23 17:27:56 +02:00
Brett Cannon c049952de7 Issue #13959: Have
importlib.abc.FileLoader.load_module()/get_filename() and
importlib.machinery.ExtensionFileLoader.load_module() have their
single argument be optional as the loader's constructor has all the
ncessary information.

This allows for the deprecation of
imp.load_source()/load_compile()/load_package().
2012-05-11 14:48:41 -04:00
Brett Cannon 410e88d5fc Change tests for imp.cache_from_source() to follow os.path.join/split
semantics.
2012-04-22 13:29:47 -04:00
Brett Cannon f0434e647a Issue #14599: Generalize a test for ImportError.path and add support
in Python/dynload_shlibs.c.

This should fix the remaining importlib test failure on Windows.
Support in AIX and HP-UX will be in a separate checkin.
2012-04-20 15:22:50 -04:00
Brett Cannon dd9a56953e Issue #14633: Simplify imp.find_modue() test after fixes from issue
#14629 changed the message.
2012-04-20 12:59:59 -04:00
Antoine Pitrou 9a4d7ddb6c More debug output 2012-02-27 22:01:25 +01:00
Antoine Pitrou ffd85c8182 Improve debugging output for test failure 2012-02-27 20:04:05 +01:00
Antoine Pitrou 4f92a68a81 Issue #14080: fix sporadic test_imp failure. Patch by Stefan Krah. 2012-02-26 18:09:50 +01:00
Antoine Pitrou 658d1963e1 Additional debug info in case of failure 2012-02-22 02:46:58 +01:00
Antoine Pitrou 037615e1ef unload() should be sufficient 2012-02-22 02:30:09 +01:00
Antoine Pitrou abe72d7eb3 Try to debug sporadic test failures 2012-02-22 01:11:31 +01:00
Victor Stinner bf816223df Issue #12451: Add support.create_empty_file()
We don't need to create a temporary buffered binary or text file object just to
create an empty file.

Replace also os.fdopen(handle).close() by os.close(handle).
2011-06-30 23:25:47 +02:00
Antoine Pitrou d4a2ff40d5 Issue #11919: try to fix test_imp failure on some buildbots. 2011-04-25 21:46:04 +02:00
Antoine Pitrou 11846905d3 Issue #11919: try to fix test_imp failure on some buildbots. 2011-04-25 21:39:49 +02:00
Jesus Cea 88f7841be7 Correctly merging #9319 into 3.3? 2011-04-25 03:46:43 +02:00
Victor Stinner 7fdd0fe48f Issue #9319: Fix the unit test 2011-04-23 01:24:11 +02:00
Victor Stinner c68b6aaec8 Issue #9319: Fix a crash on parsing a Python source code without encoding
cookie and not valid in UTF-8: use "<file>" as the filename instead of
reading from NULL.
2011-04-23 00:41:19 +02:00
Victor Stinner fe7c5b5bdf Issue #9319: Include the filename in "Non-UTF8 code ..." syntax error. 2011-04-05 01:48:03 +02:00
Victor Stinner ccbf475dfd Fix imp.cache_from_source() if the directory name contains a dot
If the directory name contains a dot but not the filename, don't strip at the
dot.
2011-03-14 15:05:12 -04:00
Ezio Melotti b3aedd4862 #9424: Replace deprecated assert* methods in the Python test suite. 2010-11-20 19:04:17 +00:00
Brett Cannon 749afa95ce Move test_imp over to file context managers. 2010-10-29 23:47:23 +00:00
Alexander Belopolsky e8f583244a Issue #9308: Removed redundant coding cookies. Added tests for
importing encoded modules that do not depend on specific stdlib
modules being encoded in a certain way.
2010-10-15 16:28:20 +00:00
Victor Stinner 15d597a245 test_imp: getfilesystemencoding() cannot be None anymore
And the codec name is normalized.
2010-09-29 16:59:46 +00:00
Victor Stinner 09c449c7de Fix a typo: TESTFN_UNENCODEABLE => TESTFN_UNENCODABLE 2010-08-13 22:23:24 +00:00
Victor Stinner 1a4d12d746 Issue #9425: NullImporter constructor is fully unicode compliant
* On non-Windows OSes: the constructor accepts bytes filenames
   and use surrogateescape for unicode filenames
 * On Windows: use GetFileAttributesW() instead of GetFileAttributesA()
2010-08-13 13:07:29 +00:00
Benjamin Peterson 335d2c757d pydoc still has a silly encoding 2010-07-05 14:59:40 +00:00
Barry Warsaw 28a691b7fd PEP 3147 2010-04-17 00:19:56 +00:00
Florent Xicluna 97133720fc Typo 2010-03-20 20:31:34 +00:00
Florent Xicluna 21164ce8f1 #8133: Use appropriate Unicode decomposition on MacOS X platform. 2010-03-20 20:30:53 +00:00
Benjamin Peterson 25bfc55afe take into account shebang line change 2010-03-11 23:59:55 +00:00
Ezio Melotti 41a6b04b1f The test was failing because the curdir was missing from sys.path. This should fix the problem. 2010-03-06 01:50:25 +00:00
Ezio Melotti 435b531873 Cleanup and minor fixes. 2010-03-06 01:20:49 +00:00
Ezio Melotti 06dbff3b1f sys.getdefaultencoding() can return None. 2010-03-05 15:17:26 +00:00
Ezio Melotti 76e0d1a6ef r78689 enabled the test on more platforms but the buildbot did not like it. Using the filesystem encoding might work better. Also see #5604. 2010-03-05 15:08:19 +00:00
Ezio Melotti 9a7d5ac9f6 This fixes a missing .lower() on the encoding name, a wrong byte undecodable by UTF-8, a wrong variable name, hopefully some windows buildbot on 3.x and adds a proper skip. It might break other things though. 2010-03-05 12:43:17 +00:00
Nick Coghlan 6ead552b47 Note that a number of the changes listed below were not applicable to the Py3k branch, and hence the corresponding
files are unchanged in this checkin. This checkin is also the first time the environment checking in regrtest has
been forward ported to the Py3k branch.

This checkin causes test_xmlrpc to fail - see issue 7165 (it's a bug in the 3.x version of xmlrpc.server)
I am also getting a failure in test_telnetlib, but it isn't clear yet if that is due to these changes.

Recorded merge of revisions 75400-75401,75404,75406,75414,75416,75422,75425-75428,75435,75439,75441-75444,75447-75449,75451-75453,75455-75458,75460-75469,75471-75473,75475-75477,75479-75481,75483,75486-75489 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75400 | r.david.murray | 2009-10-14 23:58:07 +1000 (Wed, 14 Oct 2009) | 6 lines

  Enhanced Issue 7058 patch, which will not be backported.  Refactors the
  code, adds checks for stdin/out/err, cwd, and sys.path, and adds a new
  section in the summary for tests that modify the environment (thanks to
  Ezio Melotti for that suggestion).
........
  r75453 | nick.coghlan | 2009-10-17 16:33:05 +1000 (Sat, 17 Oct 2009) | 1 line

  Correctly restore sys.stdout in test_descr
........
  r75456 | nick.coghlan | 2009-10-17 17:30:40 +1000 (Sat, 17 Oct 2009) | 1 line

  Enhancement to the new environment checking code to print the changed items under -vv. Also includes a small tweak to allow underscores in the names of resources.
........
  r75457 | nick.coghlan | 2009-10-17 17:34:27 +1000 (Sat, 17 Oct 2009) | 1 line

  Formatting tweak so that before and after values are vertically aligned
........
  r75458 | nick.coghlan | 2009-10-17 18:21:21 +1000 (Sat, 17 Oct 2009) | 1 line

  Check and revert expected sys.path alterations
........
  r75461 | nick.coghlan | 2009-10-18 00:40:54 +1000 (Sun, 18 Oct 2009) | 1 line

  Restore original sys.path when running TTK tests
........
  r75462 | nick.coghlan | 2009-10-18 01:09:41 +1000 (Sun, 18 Oct 2009) | 1 line

  Don't invoke reload(sys) and use StringIO objects instead of real files to capture stdin and stdout when needed (ensures all sys attributes remain unmodified after test_xmlrpc runs)
........
  r75463 | nick.coghlan | 2009-10-18 01:23:08 +1000 (Sun, 18 Oct 2009) | 1 line

  Revert changes made to environment in test_httpservers
........
  r75465 | nick.coghlan | 2009-10-18 01:45:52 +1000 (Sun, 18 Oct 2009) | 1 line

  Move restoration of the os.environ object into the context manager where it belongs
........
  r75466 | nick.coghlan | 2009-10-18 01:48:16 +1000 (Sun, 18 Oct 2009) | 1 line

  Also check and restore identity of sys.path, sys.argv and os.environ rather than just their values (this picked up a few more misbehaving tests)
........
  r75467 | nick.coghlan | 2009-10-18 01:57:42 +1000 (Sun, 18 Oct 2009) | 1 line

  Avoid replacing existing modules and sys.path in import tests
........
  r75468 | nick.coghlan | 2009-10-18 02:19:51 +1000 (Sun, 18 Oct 2009) | 1 line

  Don't replace sys.path in test_site
........
  r75481 | nick.coghlan | 2009-10-18 15:38:48 +1000 (Sun, 18 Oct 2009) | 1 line

  Using CleanImport to revert a reload of the os module doesn't work due to function registrations in copy_reg. The perils of reloading modules even for tests...
........
  r75486 | nick.coghlan | 2009-10-18 20:29:10 +1000 (Sun, 18 Oct 2009) | 1 line

  Silence a deprecation warning by using the appropriate replacement construct
........
  r75489 | nick.coghlan | 2009-10-18 20:56:21 +1000 (Sun, 18 Oct 2009) | 1 line

  Restore sys.path in test_tk
........
2009-10-18 13:19:33 +00:00
Benjamin Peterson c9c0f201fe convert old fail* assertions to assert* 2009-06-30 23:06:06 +00:00
Guido van Rossum 0ad59d467d Issue #5604: non-ASCII characters in module name passed to
imp.find_module() were converted to UTF-8 while the path is
converted to the default filesystem encoding, causing nonsense.
Thanks to Andrew Svetlov.

(This time to the right branch.  Will block duplicate merge to 3.0.2.)
2009-03-30 22:01:35 +00:00
Hirokazu Yamamoto 36144098e3 Issue #3806: LockTests in test_imp should be skipped when thread is not available.
Reviewed by Benjamin Peterson.
2008-09-09 07:33:27 +00:00
Brett Cannon 8a9583ec5c PyTokenizer_FindEncoding() always failed because it set the tokenizer state
with only a file pointer when it called fp_setreadl() which expected a file
path. Changed fp_setreadl() to use either a file path or file descriptor
(derived from the file pointer) to fix the issue.

Closes issue 3594.
Reviewed by Antoine Pitrou and Benjamin Peterson.
2008-09-04 05:04:25 +00:00
Benjamin Peterson ee8712cda4 #2621 rename test.test_support to test.support 2008-05-20 21:35:26 +00:00
Christian Heimes 05e8be17fd Merged revisions 60990-61002 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r60990 | eric.smith | 2008-02-23 17:05:26 +0100 (Sat, 23 Feb 2008) | 1 line

  Removed duplicate Py_CHARMASK define.  It's already defined in Python.h.
........
  r60991 | andrew.kuchling | 2008-02-23 17:23:05 +0100 (Sat, 23 Feb 2008) | 4 lines

  #1330538: Improve comparison of xmlrpclib.DateTime and datetime instances.
  Remove automatic handling of datetime.date and datetime.time.
  This breaks backward compatibility, but python-dev discussion was strongly
  against this automatic conversion; see the bug for a link.
........
  r60994 | andrew.kuchling | 2008-02-23 17:39:43 +0100 (Sat, 23 Feb 2008) | 1 line

  #835521: Add index entries for various pickle-protocol methods and attributes
........
  r60995 | andrew.kuchling | 2008-02-23 18:10:46 +0100 (Sat, 23 Feb 2008) | 2 lines

  #1433694: minidom's .normalize() failed to set .nextSibling for last element.
  Fix by Malte Helmert
........
  r61000 | christian.heimes | 2008-02-23 18:40:11 +0100 (Sat, 23 Feb 2008) | 1 line

  Patch #2167 from calvin: Remove unused imports
........
  r61001 | christian.heimes | 2008-02-23 18:42:31 +0100 (Sat, 23 Feb 2008) | 1 line

  Patch #1957: syslogmodule: Release GIL when calling syslog(3)
........
  r61002 | christian.heimes | 2008-02-23 18:52:07 +0100 (Sat, 23 Feb 2008) | 2 lines

  Issue #2051 and patch from Alexander Belopolsky:
  Permission for pyc and pyo files are inherited from the py file.
........
2008-02-23 18:30:17 +00:00
Christian Heimes 13a7a21258 Issue #1762972: Readded the reload() function as imp.reload() 2008-01-07 17:13:09 +00:00
Guido van Rossum 40d20bcf1f Issue 1267, continued.
Additional patch by Christian Heimes to deal more cleanly with the
FILE* vs file-descriptor issues.
I cleaned up his code a bit, and moved the lseek() call into import.c.
2007-10-22 00:09:51 +00:00
Guido van Rossum ce3a72aec6 Patch 1267 by Christian Heimes.
Move the initialization of sys.std{in,out,err} and __builtin__.open
to C code.
This solves the problem that "python -S" wouldn't work.
2007-10-19 23:16:50 +00:00