Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: test_{{cc.repo_name}}.py: setup, seq, exit #52

Merged
merged 3 commits into from
Oct 8, 2015

Conversation

westurner
Copy link
Contributor

No description provided.

For purposes of test scope, tearDown would be handling attributes configured in setUp,
which is easier to read when the sequence is setUp, tearDown.
Prefix test cases with three digits \d{3}, for lexicographic sorting
Exit with the returncode of unittest.main()
@audreyfeldroy
Copy link
Owner

Sorry for the delay @westurner.

Anyone else have feedback on this?

@eliasdorneles
Copy link
Collaborator

Well, the main block using unittest.main() was removed in a previous commit: c8bd365
I believe the reasoning is that we shouldn't rely a main block in the test to run the test suite, it brings import issues (and then you have to fiddle with the path to make the test work as a main or install the package as editable).

Running a specific test suite can be done in different ways, with: python setup.py test --test-suite tests.test_boilerplate or with tools like nose, py.test, etc.

So, +0 from me.

@westurner
Copy link
Contributor Author

I believe the reasoning is that we shouldn't rely a main block in the test to run the test suite, it brings import issues (and then you have to fiddle with the path to make the test work as a main or install the package as editable).

I often find it justifiable to add a -t/--test CLI option to make the [program] self-testing.
(which does not require pip install package[dev,test], tests_require, requirements-test.txt).

  • It's also necessary to pop the not-test-args from sys.argv before unittest.main.

I suppose self-testing is the value here, and not this little snippet.

@westurner
Copy link
Contributor Author

As a startup CRC, a -t/--test option that prempts before continuing with the next operations may or may not be necessary.

@westurner
Copy link
Contributor Author

@westurner
Copy link
Contributor Author

skipif would be great to have in e.g. unittest3

@audreyfeldroy audreyfeldroy merged commit 62d8331 into audreyfeldroy:master Oct 8, 2015
@audreyfeldroy
Copy link
Owner

I see now, thanks for the explanation. Merged. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants