nose-devs / nose

nose is nicer testing for python
http://readthedocs.org/docs/nose/en/latest/
1.36k stars 396 forks source link

Make tests work with Python ≥ 3.5 #983

Closed mitya57 closed 8 years ago

mitya57 commented 8 years ago

Use startswith/endswith instead of strict matching on class names.

Also, in unit_tests/test_xunit.py, drop support for Python ≤ 2.4 which did not have ElementTree.

This fixes #928.

jszakmeister commented 8 years ago

Thank you. I appreciate you taking the time to put something together, but isn't this just covering up the problem? ISTM the larger issue would be that class names are not being preserved. :-(

mitya57 commented 8 years ago

@jszakmeister According to http://bugs.python.org/issue22032#msg251500, "tests should not rely on the exact representation". So this is what I did.

jszakmeister commented 8 years ago

Okay, but the difference in output is striking (from #928):

    - test (package2c.test_module.TestCase) ... ok
    ?                             ^^  ^  ^
    + test (package2c.test_module.transplant_class.<locals>.C) ... ok
    ?                             ^^^^ ++++ ^^^  ^^^^^^^^^^^^

Who is going to know what package2c.test_module.transplant_class.<locals>.C refers to? That's the root problem to me. Making the tests pass seems like papering over the real problem.

mitya57 commented 8 years ago

@jszakmeister Okay, here comes something much cleaner.

jszakmeister commented 8 years ago

Much better! Thank you!