nose-devs / nose

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

nosetests error "TypeError (Cannot extend enumerations)" #1056

Closed abcondas closed 7 years ago

abcondas commented 7 years ago

I've created a testsuite.py module that sets up a python testsuite. This module imports an enum class with 3 members:

# test_helper.py
class TestType(Enum):
    ONE = 1
    TWO = 2 
    THREE = 3
# testsuite.py
...
from test_helper import TestType
... create, add, and run testsuite

when I execute this module using nosetests I receive the error: Failure: TypeError (Cannot extend enumerations) ... ERROR

nose seems to be doing discovery and attempts to extend the enum class which is not allowed in python. Seems like a bug. Please advise.

datalogics-robb commented 7 years ago

Nose looks for classes whose names begin with ‘Test’ and considers those tests to be run. Perhaps your example would work as you would expect, if it had a name that did not being with 'Test'

From: Ara Bravo Condas notifications@github.com<mailto:notifications@github.com> Reply-To: nose-devs/nose reply@reply.github.com<mailto:reply@reply.github.com> Date: Monday, July 17, 2017 at 2:09 PM To: nose-devs/nose nose@noreply.github.com<mailto:nose@noreply.github.com> Cc: Subscribed subscribed@noreply.github.com<mailto:subscribed@noreply.github.com> Subject: [nose-devs/nose] nosetests error "TypeError (Cannot extend enumerations)" (#1056)

I've created a testsuite.py module that sets up a python testsuite. This module imports an enum class with 3 members:

test_helper.py

class TestType(Enum): ONE = 1 TWO = 2 THREE = 3

testsuite.py

... from test_helper import TestType ... create, add, and run testsuite

when I execute this module using nosetests I receive the error: Failure: TypeError (Cannot extend enumerations) ... ERROR

nose seems to be doing discovery and attempts to extend the enum class which is not allowed in python. Seems like a bug. Please advise.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/nose-devs/nose/issues/1056, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKsi7gSINUpIAVhFy2gEx1BsX3ueUau7ks5sO7F1gaJpZM4OaZ55.

abcondas commented 7 years ago

Thank you, Rob! That was it. I should have figured that out... (blush)