Test failures with Python 3 and enabled warnings

Bug #1152860 reported by Arfrever Frehtes Taifersar Arahesis on 2013-03-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zope.password
Undecided
Unassigned

Bug Description

When warnings are enabled (using e.g. PYTHONWARNINGS="a" environmental variable), then 3 tests fail, because they expect empty stderr.

$ PYTHONWARNINGS="a" python3.3 setup.py test
setup.py:40: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.txt' mode='r' encoding='UTF-8'>
  + '\n\n' +
setup.py:41: ResourceWarning: unclosed file <_io.TextIOWrapper name='CHANGES.txt' mode='r' encoding='UTF-8'>
  open('CHANGES.txt').read()
running test
running egg_info
writing namespace_packages to src/zope.password.egg-info/namespace_packages.txt
writing requirements to src/zope.password.egg-info/requires.txt
writing entry points to src/zope.password.egg-info/entry_points.txt
writing top-level names to src/zope.password.egg-info/top_level.txt
writing dependency_links to src/zope.password.egg-info/dependency_links.txt
writing src/zope.password.egg-info/PKG-INFO
reading manifest file 'src/zope.password.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.rst'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
writing manifest file 'src/zope.password.egg-info/SOURCES.txt'
running build_ext
MD5PasswordManager (zope.password.password)
Doctest: zope.password.password.MD5PasswordManager ... ok
PlainTextPasswordManager (zope.password.password)
Doctest: zope.password.password.PlainTextPasswordManager ... ok
SHA1PasswordManager (zope.password.password)
Doctest: zope.password.password.SHA1PasswordManager ... ok
SMD5PasswordManager (zope.password.password)
Doctest: zope.password.password.SMD5PasswordManager ... ok
SSHAPasswordManager (zope.password.password)
Doctest: zope.password.password.SSHAPasswordManager ... ok
CryptPasswordManager (zope.password.legacy)
Doctest: zope.password.legacy.CryptPasswordManager ... ok
MySQLPasswordManager (zope.password.legacy)
Doctest: zope.password.legacy.MySQLPasswordManager ... ok
setUpPasswordManagers (zope.password.testing)
Doctest: zope.password.testing.setUpPasswordManagers ... ok
Principal (zope.password.zpasswd)
Doctest: zope.password.zpasswd.Principal ... ok
test_config_long (zope.password.tests.test_zpasswd.ArgumentParsingTestCase) ... /tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:33: ResourceWarning: unclosed file <_io.BufferedWriter name='testsite.zcml'>
  b'<configure xmlns="http://namespaces.zope.org/zope"/>\n'
ok
test_config_short (zope.password.tests.test_zpasswd.ArgumentParsingTestCase) ... /tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:33: ResourceWarning: unclosed file <_io.BufferedWriter name='testsite.zcml'>
  b'<configure xmlns="http://namespaces.zope.org/zope"/>\n'
ok
test_destination_long (zope.password.tests.test_zpasswd.ArgumentParsingTestCase) ... /tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:33: ResourceWarning: unclosed file <_io.BufferedWriter name='testsite.zcml'>
  b'<configure xmlns="http://namespaces.zope.org/zope"/>\n'
ok
test_destination_short (zope.password.tests.test_zpasswd.ArgumentParsingTestCase) ... /tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:33: ResourceWarning: unclosed file <_io.BufferedWriter name='testsite.zcml'>
  b'<configure xmlns="http://namespaces.zope.org/zope"/>\n'
ok
test_help_long (zope.password.tests.test_zpasswd.ArgumentParsingTestCase) ... /tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:33: ResourceWarning: unclosed file <_io.BufferedWriter name='testsite.zcml'>
  b'<configure xmlns="http://namespaces.zope.org/zope"/>\n'
FAIL
test_help_short (zope.password.tests.test_zpasswd.ArgumentParsingTestCase) ... /tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:33: ResourceWarning: unclosed file <_io.BufferedWriter name='testsite.zcml'>
  b'<configure xmlns="http://namespaces.zope.org/zope"/>\n'
FAIL
test_no_arguments (zope.password.tests.test_zpasswd.ArgumentParsingTestCase) ... /tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:33: ResourceWarning: unclosed file <_io.BufferedWriter name='testsite.zcml'>
  b'<configure xmlns="http://namespaces.zope.org/zope"/>\n'
ok
test_version_long (zope.password.tests.test_zpasswd.ArgumentParsingTestCase) ... /tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:33: ResourceWarning: unclosed file <_io.BufferedWriter name='testsite.zcml'>
  b'<configure xmlns="http://namespaces.zope.org/zope"/>\n'
FAIL
test_principal_information (zope.password.tests.test_zpasswd.InputCollectionTestCase) ... /tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:33: ResourceWarning: unclosed file <_io.BufferedWriter name='testsite.zcml'>
  b'<configure xmlns="http://namespaces.zope.org/zope"/>\n'
ok

======================================================================
FAIL: test_help_long (zope.password.tests.test_zpasswd.ArgumentParsingTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 62, in check_stdout_content
    options = self.parse_args(args)
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 55, in parse_args
    options = zpasswd.parse_args(argv)
SystemExit: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 79, in test_help_long
    self.check_stdout_content(["--help"])
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 66, in check_stdout_content
    self.failIf(self.stderr.getvalue())
AssertionError: '/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:65: DeprecationWarning: Please use assertTrue instead.\n self.assert_(self.stdout.getvalue())\n' is not false

======================================================================
FAIL: test_help_short (zope.password.tests.test_zpasswd.ArgumentParsingTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 62, in check_stdout_content
    options = self.parse_args(args)
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 55, in parse_args
    options = zpasswd.parse_args(argv)
SystemExit: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 82, in test_help_short
    self.check_stdout_content(["-h"])
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 66, in check_stdout_content
    self.failIf(self.stderr.getvalue())
AssertionError: '/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:65: DeprecationWarning: Please use assertTrue instead.\n self.assert_(self.stdout.getvalue())\n' is not false

======================================================================
FAIL: test_version_long (zope.password.tests.test_zpasswd.ArgumentParsingTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 62, in check_stdout_content
    options = self.parse_args(args)
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 55, in parse_args
    options = zpasswd.parse_args(argv)
SystemExit: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 76, in test_version_long
    self.check_stdout_content(["--version"])
  File "/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py", line 66, in check_stdout_content
    self.failIf(self.stderr.getvalue())
AssertionError: '/tmp/zope.password-4.0.0/src/zope/password/tests/test_zpasswd.py:65: DeprecationWarning: Please use assertTrue instead.\n self.assert_(self.stdout.getvalue())\n' is not false

----------------------------------------------------------------------
Ran 18 tests in 0.113s

FAILED (failures=3)

Changed in zope.password:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers