GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Tests fail with Python 3.5 · Issue #928 · nose-devs/nose

Tests fail with Python 3.5 #928

New issue
Copy link
New issue
Copy link
Closed
#983
Closed
Tests fail with Python 3.5#928
#983
Copy link

Description

@mitya57
mitya57
opened on Jun 24, 2015
Issue body actions

In a test rebuild on Ubuntu, some tests failed with Python 3.5:

======================================================================
FAIL: Doctest: imported_tests.rst
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.5/doctest.py", line 2189, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for imported_tests.rst
  File "/«PKGBUILDDIR»/build/tests/functional_tests/doc_tests/test_issue145/imported_tests.rst", line 0

----------------------------------------------------------------------
File "/«PKGBUILDDIR»/build/tests/functional_tests/doc_tests/test_issue145/imported_tests.rst", line 43, in imported_tests.rst
Failed example:
    run(argv=argv) # doctest: +REPORT_NDIFF
Differences (ndiff with -expected +actual):
      package1 setup
      test (package1.test_module.TestCase) ... ok
      package1.test_module.TestClass.test_class ... ok
      package1.test_module.test_function ... ok
      package2c setup
    - test (package2c.test_module.TestCase) ... ok
    ?                             ^^  ^  ^
    + test (package2c.test_module.transplant_class.<locals>.C) ... ok
    ?                             ^^^^ ++++ ^^^  ^^^^^^^^^^^^
      package2c.test_module.TestClass.test_class ... ok
      package2f setup
      package2f.test_module.test_function ... ok
      <BLANKLINE>
      ----------------------------------------------------------------------
      Ran 6 tests in ...s
      <BLANKLINE>
      OK
----------------------------------------------------------------------
File "/«PKGBUILDDIR»/build/tests/functional_tests/doc_tests/test_issue145/imported_tests.rst", line 72, in imported_tests.rst
Failed example:
    run(argv=argv) # doctest: +REPORT_NDIFF
Differences (ndiff with -expected +actual):
      package2c setup
    - test (package2c.test_module.TestCase) ... ok
    ?                             ^^  ^  ^
    + test (package2c.test_module.transplant_class.<locals>.C) ... ok
    ?                             ^^^^ ++++ ^^^  ^^^^^^^^^^^^
      package2c.test_module.TestClass.test_class ... ok
      <BLANKLINE>
      ----------------------------------------------------------------------
      Ran 2 tests in ...s
      <BLANKLINE>
      OK
----------------------------------------------------------------------
File "/«PKGBUILDDIR»/build/tests/functional_tests/doc_tests/test_issue145/imported_tests.rst", line 99, in imported_tests.rst
Failed example:
    run(argv=argv) # doctest: +REPORT_NDIFF
Differences (ndiff with -expected +actual):
      package2c setup
    - test (package2c.test_module.TestCase) ... ok
    ?                             ^^  ^  ^
    + test (package2c.test_module.transplant_class.<locals>.C) ... ok
    ?                             ^^^^ ++++ ^^^  ^^^^^^^^^^^^
      <BLANKLINE>
      ----------------------------------------------------------------------
      Ran 1 test in ...s
      <BLANKLINE>
      OK


======================================================================
FAIL: runTest (test_load_tests_from_test_case.TestLoadTestsFromTestCaseHook)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/«PKGBUILDDIR»/build/tests/functional_tests/test_load_tests_from_test_case.py", line 52, in runTest
    self.assertEqual(line.strip(), expect.pop(0))
AssertionError: 'test[34 chars]case.NoFixturePlug.loadTestsFromTestCase.<loca[18 chars]RROR' != 'test[34 chars]case.Derived) ... ERROR'
- test_value (test_load_tests_from_test_case.NoFixturePlug.loadTestsFromTestCase.<locals>.Derived) ... ERROR
+ test_value (test_load_tests_from_test_case.Derived) ... ERROR

-------------------- >> begin captured stdout << ---------------------
options
configure
Called!
test_value (test_load_tests_from_test_case.NoFixturePlug.loadTestsFromTestCase.<locals>.Derived) ... ERROR
test_value (tests.Tests) ... ok

======================================================================
ERROR: test_value (test_load_tests_from_test_case.NoFixturePlug.loadTestsFromTestCase.<locals>.Derived)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/«PKGBUILDDIR»/build/tests/functional_tests/support/ltftc/tests.py", line 9, in test_value
    self.assertEqual(self.value, 1)
AttributeError: 'Derived' object has no attribute 'value'

----------------------------------------------------------------------
Ran 2 tests in 0.016s

FAILED (errors=1)


--------------------- >> end captured stdout << ----------------------

======================================================================
FAIL: test_addError (test_xunit.TestXMLOutputWithXML)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/«PKGBUILDDIR»/build/tests/unit_tests/test_xunit.py", line 193, in test_addError
    eq_(tc.attrib['classname'], "test_xunit.TC")
AssertionError: 'test_xunit.mktest.<locals>.TC' != 'test_xunit.TC'
-------------------- >> begin captured stdout << ---------------------
b'<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="1" errors="1" failures="0" skip="0"><testcase classname="test_xunit.mktest.&lt;locals&gt;.TC" name="runTest" time="0.000"><error type="builtins.RuntimeError" message="some error happened"><![CDATA[Traceback (most recent call last):\n  File "/«PKGBUILDDIR»/build/tests/unit_tests/test_xunit.py", line 175, in test_addError\n    raise RuntimeError("some error happened")\nRuntimeError: some error happened\n]]></error></testcase></testsuite>'

--------------------- >> end captured stdout << ----------------------

======================================================================
FAIL: test_addFailure (test_xunit.TestXMLOutputWithXML)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/«PKGBUILDDIR»/build/tests/unit_tests/test_xunit.py", line 126, in test_addFailure
    eq_(tc.attrib['classname'], "test_xunit.TC")
AssertionError: 'test_xunit.mktest.<locals>.TC' != 'test_xunit.TC'
-------------------- >> begin captured stdout << ---------------------
b'<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="1" errors="0" failures="1" skip="0"><testcase classname="test_xunit.mktest.&lt;locals&gt;.TC" name="runTest" time="0.000"><failure type="builtins.AssertionError" message="one is not \'equal\' to two"><![CDATA[Traceback (most recent call last):\n  File "/«PKGBUILDDIR»/build/tests/unit_tests/test_xunit.py", line 108, in test_addFailure\n    raise AssertionError("one is not \'equal\' to two")\nAssertionError: one is not \'equal\' to two\n]]></failure></testcase></testsuite>'

--------------------- >> end captured stdout << ----------------------

======================================================================
FAIL: test_addSuccess (test_xunit.TestXMLOutputWithXML)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/«PKGBUILDDIR»/build/tests/unit_tests/test_xunit.py", line 282, in test_addSuccess
    eq_(tc.attrib['classname'], "test_xunit.TC")
AssertionError: 'test_xunit.mktest.<locals>.TC' != 'test_xunit.TC'
-------------------- >> begin captured stdout << ---------------------
b'<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="1" errors="0" failures="0" skip="0"><testcase classname="test_xunit.mktest.&lt;locals&gt;.TC" name="runTest" time="0.000"></testcase></testsuite>'

--------------------- >> end captured stdout << ----------------------

Activity

  1. rkuska commented on Sep 24, 2015

    @rkuska
    rkuska
    on Sep 24, 2015
    Contributor
    More actions

    I've tracked this to http://bugs.python.org/issue22032

    I see there two options either don't check for the exact value or implement own id function which will use __name__ instead of __qualname__.

  2. brianmay commented on Jan 23, 2016

    @brianmay
    brianmay
    on Jan 23, 2016
    More actions

    The tests also fail on Debian with Python 3.5. Any chance for a fix?

  3. mitya57
    added a commit that references this issue on Jan 26, 2016

    Make tests work with Python ≥ 3.5

    This issue will close once commit eb6a303 is merged into the 'master' branch.
    eb6a303
  4. mitya57 commented on Jan 26, 2016

    @mitya57
    mitya57
    on Jan 26, 2016
    ContributorAuthor
    More actions

    I've just submitted PR #983 for this. It would be super nice if a new release with that merged is rolled out.

  5. mitya57
    added a commit that references this issue on Jan 31, 2016

    Set __qualname__ equal to __name__ on derived classes

    This issue will close once commit 8e7ad3d is merged into the 'master' branch.
    8e7ad3d
  6. jszakmeister
    closed this as completedin #983on Feb 2, 2016
  7. sandeegar commented on Aug 15, 2017

    @sandeegar
    sandeegar
    on Aug 15, 2017
    More actions

    I am using python 3.5.2 facing issue in teamcity in dockerized environment the error coming is as below
    init (spec.api_tests.transplant_class..C) ... ERROR

    Can anyone help on this ?

  8. johnwhelchel commented on Jun 5, 2018

    @johnwhelchel
    johnwhelchel
    on Jun 5, 2018
    More actions

    I had this issue working with some of my tests and want to post the solution in case it helps others. I trapped a keyboard interrupt with set_trace in a known test that also weirdly ran this transplant test. I then went up the call stack into nose internals and let the program step until I figured out this transplant test was a test from a totally different file.

    I happened to be importing this different file into my test in question, which for some reason called nose to run those tests as well. Refactoring the code so I didn't pull in this other test class solved the problem.

    Reacted by John Huffsmith
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.