Open Bug 1504067 Opened 4 years ago Updated 3 years ago

remove unittest.TestCase usage

Categories

(Socorro :: General, task, P3)

Tracking

(Not tracked)

People

(Reporter: willkg, Unassigned)

Details

Attachments

(3 files)

Some things are easier to do in pytest if unittest.TestCase isn't involved.

https://docs.pytest.org/en/latest/unittest.html

pytest parametrization is pretty super-duper, pytest fixtures are easier to use, the setup/teardown is subtly different between unittest.TestCase things and non-unittest.TestCase things, etc.

This bug covers removing unittest.TestCase usage from the webapp tests.
This isn't *super* important, but detangling the mocking and scaffolding in the webapp tests will make them easier to read, write, and maintain.
Priority: -- → P3
Commits pushed to master at https://github.com/mozilla-services/socorro

https://github.com/mozilla-services/socorro/commit/09c1f0a65b5419e210095949146b5272e8d1e2e6
bug 1504067: first pass at removing unittest things

This converts some classes to subclass object rather than a TestCase thing.
For those tests, I switched to using fixtures where I could.

This removes all the self.assert* type calls except one that checks num
queries. There's a pytest-django fixture that does the same thing, but we'd
have to convert the class first. Tricky.

This removes all the unittest.TestCase subclassing. There are still a bunch
that subclass Django's TestCase. That'll require more work to remove since we
have a bunch of scaffolding that is intertwined with that.

https://github.com/mozilla-services/socorro/commit/8adaee728c9d960fb6613260c053720bcdfb799f
Merge pull request #4687 from willkg/1504067-unittest

bug 1504067: first pass at removing unittest things
Let's generalize this to the whole codebase.
Component: Webapp → General
Commits pushed to master at https://github.com/mozilla-services/socorro

https://github.com/mozilla-services/socorro/commit/031932eeb39e58aa2b85d888dff6da42501ee3f0
bug 1504067: remove unittest from socorro/unittest/ tests

This removes use of unittest.TestCase from the socorro/unittest/ tests. In
doing that, I also created a fixture to handle db stuff and moved the req_mock
fixture.  I fixed the Elasticsearch tests which were order dependent because
they were adjusting a_processed_crash. I also removed a bunch of unused code.

https://github.com/mozilla-services/socorro/commit/3028af6840776c9883c58cbb8534c0eed6a79d49
Merge pull request #4734 from willkg/1504067-testbase

bug 1504067: remove unittest from socorro/unittest/ tests
Commits pushed to master at https://github.com/mozilla-services/socorro

https://github.com/mozilla-services/socorro/commit/5e8501913d06f0e2874a922b1c1488d978256644
bug 1504067: un-unittest.TestCase-ize some more tests

https://github.com/mozilla-services/socorro/commit/04566f9c6f9415a38acc68faf6534f9eaaab0a6d
Merge pull request #4796 from willkg/1504067-crashstats

bug 1504067: un-unittest.TestCase-ize some more tests

Unassigning myself since I'm not going to get to this any time soon.

Assignee: willkg → nobody
You need to log in before you can comment on or make changes to this bug.