Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

add ability to load tests using dotnames in rosunit#104

Merged
dirk-thomas merged 1 commit intoindigo-develfrom
update_pr101
Mar 1, 2016
Merged

add ability to load tests using dotnames in rosunit#104
dirk-thomas merged 1 commit intoindigo-develfrom
update_pr101

Conversation

@dirk-thomas
Copy link
Copy Markdown
Member

Replaces #101.

Simplify the selection logic and cleanup new Python code.

dirk-thomas added a commit that referenced this pull request Mar 1, 2016
add ability to load tests using dotnames in rosunit
@dirk-thomas dirk-thomas merged commit d6650c4 into indigo-devel Mar 1, 2016
@dirk-thomas dirk-thomas deleted the update_pr101 branch March 1, 2016 01:15
@dirk-thomas
Copy link
Copy Markdown
Member Author

Cherry picked to jade-devel: 7b8a64d

if issubclass(test, unittest.TestCase):
suite = unittest.TestLoader().loadTestsFromTestCase(test)
else:
suite = unittest.TestLoader().loadTestsFromName(test)
Copy link
Copy Markdown
Contributor

@stonier stonier Sep 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails. I guess it broke when simplifying the logic in #101 to create PR #104.

The intention is for a string to pass through the first check into the loadTestsFromName call, but it never gets there since the first method throws a TypeError.

$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import unittest
>>> issubclass("foo", unittest.TestCase)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: issubclass() arg 1 must be a class
>>>

Not a very intuitive function that. If it's not going to return False, it's going to be a good source of bugs like this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reporting this and providing a PR (#121).

@stonier
Copy link
Copy Markdown
Contributor

stonier commented Sep 19, 2016

Thanks @dirk-thomas. Had Korean thanksgiving get in the way and just got back only to find it already done.

@dirk-thomas
Copy link
Copy Markdown
Member Author

No problem. I just wanted to release a new version so went ahead.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants