Commit Graph

130 Commits

Author SHA1 Message Date
Brett Cannon c3e8867a41 Skip a recursion depth check test when running under CPython and have a trace
function set. Otherwise a Python fatal error about hitting an unrecoverable
recursion depth gets triggered.

Closes issue #10985. Code review by Georg Brandl.
2011-01-23 23:06:05 +00:00
Raymond Hettinger 7d967712b8 Update tests and whatsnew for the 'quiet' flag 2011-01-05 20:24:08 +00:00
Victor Stinner baab9d0bf6 Issue #10783: Fix test_sys, pack('c', ' ') => pack('c', b' ') 2010-12-28 13:33:43 +00:00
Nick Coghlan 37ee850b10 Issue 2690: Add support for slicing and negative indices to range objects (includes precalculation and storage of the range length).
Refer to the tracker issue for the language moratorium implications of this change
2010-12-03 14:26:13 +00:00
Ezio Melotti b3aedd4862 #9424: Replace deprecated assert* methods in the Python test suite. 2010-11-20 19:04:17 +00:00
Antoine Pitrou aeb6ceead7 Issue #10293: Remove obsolete field in the PyMemoryView structure,
unused undocumented value PyBUF_SHADOW, and strangely-looking code in
PyMemoryView_GetContiguous.
2010-11-04 20:30:33 +00:00
Antoine Pitrou fbb1c6191c Follow up to #9778: fix regressions on 64-bit Windows builds 2010-10-23 17:37:54 +00:00
Victor Stinner f6211eda71 Move test_undecodable_code() from test_sys to test_cmd_line 2010-10-20 21:52:33 +00:00
Barry Warsaw 8cf4eae522 First (uncontroversial) part of issue 9807.
* Expose the build flags to Python as sys.abiflags
* Shared library libpythonX.Y<abiflags>.so
* python-config --abiflags
* Make two distutils tests that failed with --enable-shared (even before this
  patch) succeed.
* Fix a few small style issues.
2010-10-16 01:04:07 +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 d24fc5d7c4 test_sys: Remove workaround #8611
It looks like it is no more needed: Python 3.2 is slowly able to support
non-ascii paths with an ascii locale.
2010-10-13 23:41:57 +00:00
Victor Stinner 8f6b6b0cc3 Issue #9992: Remove PYTHONFSENCODING environment variable. 2010-10-13 22:02:27 +00:00
Victor Stinner 5b519e0201 Issue #9632: Remove sys.setfilesystemencoding() function: use PYTHONFSENCODING
environment variable to set the filesystem encoding at Python startup.
sys.setfilesystemencoding() creates inconsistencies because it is unable to
reencode all filenames in all objects.
2010-09-10 21:57:59 +00:00
Victor Stinner ef6ff662c9 Fix test_sys: set LC_ALL instead of LANG
LC_ALL is read before LANG to choose the locale encoding (LC_ALL, LANG and then
LC_CTYPE: use the first non empty variable).
2010-08-25 08:33:34 +00:00
Victor Stinner 1970b62aee Disable test_undecodable_code() of test_sys on Windows
This test is irrevelant on Windows
2010-08-25 00:20:27 +00:00
Victor Stinner ebe53a23c9 Fix test_sys for FreeBSD, Solaris and Mac OS X
_Py_char2wchar() (mbctowcs) decodes b'\xff' to '\xff' on FreeBSD, Solaris and
Mac OS X, even if the locale is C (and the locale encoding is ASCII). Patch
test_undecodable_code() to support this output and document the two different
kinds of outputs.
2010-08-24 23:05:51 +00:00
Victor Stinner c44abb127b Workaround issue #8611 in test_undecodable_code() of test_sys
Write test.support.workaroundIssue8611() function so it will be easier to
remove this workaround from all tests.
2010-08-20 16:52:14 +00:00
Victor Stinner 1b6372a1d1 test_undecodable_code(): set locale to C
The test is still failing on "x86 FreeBSD 7.2 3.x" and "sparc solaris10 gcc
3.x" buildbots. It looks like the locale encoding is able to decode b'\xff'. I
suppose that it is an encoding like 'iso-8859-1'.

Use C locale to set, I hope, the locale encoding to 'ascii'. Display also the
encoding so if the test fails, at least I will learn the locale encoding
choosen for the C locale.
2010-08-20 16:38:14 +00:00
Victor Stinner e6376f8849 test_main_invalid_unicode() of test_sys: print string as ascii
There are buildbot failures on "x86 FreeBSD 3.x" and "sparc solaris10 gcc 3.x".
I suppose that _Py_char2wchar() doesn't fail even if the locale encoding is
unable to decode the byte string, because _Py_char2wchar() has a special mode
for platform without mbrtowc() (ISO C99) function.

Let's check my theory by avoid error on the Python print() instruction.
2010-08-20 11:08:18 +00:00
Victor Stinner 515ca2047d test_main_invalid_unicode() of test_sys displays stderr on failure 2010-08-19 17:18:12 +00:00
Victor Stinner 99435247e3 Ooops, finish test_sys fix: use expected variable 2010-08-19 11:30:09 +00:00
Victor Stinner 85ca2afe3b Fix test_sys about fs encoding for Windows and Mac OS X
* Check fs encoding value on Windows
 * Ignore LANG= test on Windows and Mac OS X (fs encoding is hardcoded on these
   platforms)
2010-08-19 11:23:47 +00:00
Victor Stinner c732e3ba08 test_sys: move tests at the right place
filesystem encoding is not related to sys.sizeof()
2010-08-18 22:44:15 +00:00
Victor Stinner 398356baaa Improve error message if the command is not decodable 2010-08-18 22:23:22 +00:00
Victor Stinner 94908bbc15 Issue #8622: Add PYTHONFSENCODING environment variable to override the
filesystem encoding.

initfsencoding() displays also a better error message if get_codeset() failed.
2010-08-18 21:23:25 +00:00
Victor Stinner d62e6cabca Issue #9425: file system encoding is not always utf-8
Fix a regression introduced in test_sys by r83778.
2010-08-08 22:31:44 +00:00
Victor Stinner 6c6f851eae Issue #9425: skip tests if a filename is not encodable 2010-08-07 10:09:35 +00:00
Florent Xicluna 02ea12b291 Syntax cleanup. 2010-07-28 16:39:41 +00:00
Alexander Belopolsky 07de165d6e Corrected comments on where settrace and setprofile are tested. 2010-07-25 15:05:42 +00:00
Brian Curtin 808e1ada94 Undo inadvertant checkin. 2010-07-08 22:13:25 +00:00
Brian Curtin d40e6f70a5 Implement #1578269. Patch by Jason R. Coombs.
Added Windows support for os.symlink when run on Windows 6.0 or greater,
aka Vista. Previous Windows versions will raise NotImplementedError
when trying to symlink.

Includes numerous test updates and additions to test_os, including
a symlink_support module because of the fact that privilege escalation
is required in order to run the tests to ensure that the user is able
to create symlinks. By default, accounts do not have the required
privilege, so the escalation code will have to be exposed later (or
documented on how to do so). I'll be following up with that work next.

Note that the tests use ctypes, which was agreed on during the PyCon
language summit.
2010-07-08 21:39:08 +00:00
Victor Stinner 9a45a6b1c2 Issue #8965: Write more tests for sys.getfilesystemencoding() 2010-06-11 23:06:13 +00:00
Victor Stinner 2690461a9e Issue #8965: Add a regression test to test_sys with LANG=C 2010-06-11 22:17:52 +00:00
Victor Stinner 1286d7f060 test_sys: add a test on the file system encoding for darwin 2010-06-11 00:41:41 +00:00
Mark Dickinson dc787d2055 Issue #8188: Introduce a new scheme for computing hashes of numbers
(instances of int, float, complex, decimal.Decimal and
fractions.Fraction) that makes it easy to maintain the invariant that
hash(x) == hash(y) whenever x and y have equal value.
2010-05-23 13:33:13 +00:00
Victor Stinner 7126dbc867 Issue #3798: sys.exit(message) writes the message to sys.stderr file, instead
of the C file stderr, to use stderr encoding and error handler
2010-05-21 23:45:42 +00:00
Victor Stinner c0983856c6 Fix test_main_invalid_unicode() of test_sys for ASCII locale encoding
It should fix sparc 3.x and 3.1 failures.
2010-05-17 19:57:40 +00:00
Victor Stinner 7cf7d72263 Improve test_exit() error message to analyze sparc failures 2010-05-17 14:36:43 +00:00
Victor Stinner e9fb319e68 handle_system_exit() flushs files to warranty the output order
PyObject_Print() writes into the C object stderr, whereas PySys_WriteStderr()
writes into the Python object sys.stderr. Each object has its own buffer, so
call sys.stderr.flush() and fflush(stderr).
2010-05-17 08:58:51 +00:00
Victor Stinner 372ac5e732 PyObject_Dump() encodes unicode objects to utf8 with backslashreplace (instead
of strict) error handler to escape surrogates
2010-05-17 01:26:01 +00:00
Victor Stinner 6baded49d0 Issue #6697: Fix a crash if code of "python -c code" contains surrogates 2010-05-17 01:13:37 +00:00
Victor Stinner 45df820591 Merged revisions 80552-80556,80564-80566,80568-80571 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80552 | victor.stinner | 2010-04-27 23:46:03 +0200 (mar., 27 avril 2010) | 3 lines

  Issue #7449, part 1: fix test_support.py for Python compiled without thread
........
  r80553 | victor.stinner | 2010-04-27 23:47:01 +0200 (mar., 27 avril 2010) | 1 line

  Issue #7449, part 2: regrtest.py -j option requires thread support
........
  r80554 | victor.stinner | 2010-04-27 23:51:26 +0200 (mar., 27 avril 2010) | 9 lines

  Issue #7449 part 3, test_doctest: import trace module in test_coverage()

  Import trace module fail if the threading module is missing. test_coverage() is
  only used if test_doctest.py is used with the -c option. This commit allows to
  execute the test suite without thread support.

  Move "import trace" in test_coverage() and use
  test_support.import_module('trace').
........
  r80555 | victor.stinner | 2010-04-27 23:56:26 +0200 (mar., 27 avril 2010) | 6 lines

  Issue #7449, part 4: skip test_multiprocessing if thread support is disabled

  import threading after _multiprocessing to raise a more revelant error message:
  "No module named _multiprocessing". _multiprocessing is not compiled without
  thread support.
........
  r80556 | victor.stinner | 2010-04-28 00:01:24 +0200 (mer., 28 avril 2010) | 8 lines

  Issue #7449, part 5: split Test.test_open() of ctypes/test/test_errno.py

   * Split Test.test_open() in 2 functions: test_open() and test_thread_open()
   * Skip test_open() and test_thread_open() if we are unable to find the C
     library
   * Skip test_thread_open() if thread support is disabled
   * Use unittest.skipUnless(os.name == "nt", ...) on test_GetLastError()
........
  r80564 | victor.stinner | 2010-04-28 00:59:35 +0200 (mer., 28 avril 2010) | 4 lines

  Issue #7449, part 6: fix test_hashlib for missing threading module

  Move @test_support.reap_thread decorator from test_main() to test_threaded_hashing().
........
  r80565 | victor.stinner | 2010-04-28 01:01:29 +0200 (mer., 28 avril 2010) | 6 lines

  Issue #7449, part 7: simplify threading detection in test_capi

   * Skip TestPendingCalls if threading module is missing
   * Test if threading module is present or not, instead of test the presence of
     _testcapi._test_thread_state
........
  r80566 | victor.stinner | 2010-04-28 01:03:16 +0200 (mer., 28 avril 2010) | 4 lines

  Issue #7449, part 8: don't skip the whole test_asynchat if threading is missing

  TestFifo can be executed without the threading module
........
  r80568 | victor.stinner | 2010-04-28 01:14:58 +0200 (mer., 28 avril 2010) | 6 lines

  Issue #7449, part 9: fix test_xmlrpclib for missing threading module

   * Skip testcases using threads if threading module is missing
   * Use "http://" instead of URL in ServerProxyTestCase if threading is missing
     because URL is not set in this case
........
  r80569 | victor.stinner | 2010-04-28 01:33:58 +0200 (mer., 28 avril 2010) | 6 lines

  Partial revert of r80556 (Issue #7449, part 5, fix ctypes test)

  Rewrite r80556: the thread test have to be executed just after the test on
  libc_open() and so the test cannot be splitted in two functions (without
  duplicating code, and I don't want to duplicate code).
........
  r80570 | victor.stinner | 2010-04-28 01:51:16 +0200 (mer., 28 avril 2010) | 8 lines

  Issue #7449, part 10: test_cmd imports trace module using test_support.import_module()

  Use test_support.import_module() instead of import to raise a SkipTest
  exception if the import fail. Import trace fails if the threading module is
  missing.

  See also part 3: test_doctest: import trace module in test_coverage().
........
  r80571 | victor.stinner | 2010-04-28 01:55:59 +0200 (mer., 28 avril 2010) | 6 lines

  Issue #7449, last part (11): fix many tests if thread support is disabled

   * Use try/except ImportError or test_support.import_module() to import thread
     and threading modules
   * Add @unittest.skipUnless(threading, ...) to testcases using threads
........
2010-04-28 22:31:17 +00:00
Victor Stinner 4ce881e928 Fix my test introduced in test_sys by r79394:
Restore the orginal filesystem encoding before testing
assertRaises(LookupError, sys.setfilesystemencoding, "xxx"). Unittest formats
the exception, but the formatting failed because the file system was invalid
(set to iso-8859-1 by the previous test).

Anyway, ensure to restore the original filesystem encoding when exiting
test_setfilesystemencoding() to avoid error propagation to the other tests.
2010-03-25 12:24:38 +00:00
Victor Stinner 120c21227a Issue #8226: sys.setfilesystemencoding() raises a LookupError if the encoding
is unknown.
2010-03-25 00:30:28 +00:00
Collin Winter 4222e9c07c Merged revisions 79060 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79060 | collin.winter | 2010-03-18 14:54:01 -0700 (Thu, 18 Mar 2010) | 4 lines

  Add support for weak references to code objects. This will be used by an optimization in the incoming Python 3 JIT.

  Patch by Reid Kleckner!
........
2010-03-18 22:46:40 +00:00
Georg Brandl 1b37e8728c Merged revisions 78093 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78093 | georg.brandl | 2010-02-07 18:03:15 +0100 (So, 07 Feb 2010) | 1 line

  Remove unused imports in test modules.
........
2010-03-14 10:45:50 +00:00
Victor Stinner 171ba0504a Merged revisions 78835-78837 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78835 | victor.stinner | 2010-03-11 13:34:39 +0100 (jeu., 11 mars 2010) | 7 lines

  Issue #7774: Set sys.executable to an empty string if argv[0] has been
  set to an non existent program name and Python is unable to retrieve the real
  program name.

  Fix also sysconfig: if sys.executable is an empty string, use the current
  working directory.
........
  r78836 | victor.stinner | 2010-03-11 14:27:35 +0100 (jeu., 11 mars 2010) | 4 lines

  Fix test_executable introduce in previous commit (r78835): Windows is able to
  retrieve the absolute Python path even if argv[0] has been set to a non
  existent program name.
........
  r78837 | victor.stinner | 2010-03-11 14:46:06 +0100 (jeu., 11 mars 2010) | 3 lines

  Another fix to test_executable() of test_sys: set the current working to avoid
  the #7774 bug.
........
2010-03-12 14:20:59 +00:00
Eric Smith a1f20b917a Merged revisions 77784 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77784 | eric.smith | 2010-01-26 21:06:25 -0500 (Tue, 26 Jan 2010) | 1 line

  Added named (but not numbered) attributes to sys.getwindowsversion() test.
........
2010-01-27 02:14:26 +00:00
Eric Smith d8aef76f6e Fixed test_support -> support. 2010-01-27 01:38:34 +00:00
Eric Smith 05f3374402 Merged revisions 77775 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77775 | eric.smith | 2010-01-26 20:21:15 -0500 (Tue, 26 Jan 2010) | 1 line

  Switch to test_support.get_attribute.
........
2010-01-27 01:25:02 +00:00