-
Notifications
You must be signed in to change notification settings - Fork 144
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
Improve test isolation and reduce test verbosity #7186 #10710 #10711
Conversation
Is there a reason why this is in the "icebox". This seems like a nice improvement. This should be put into the QA pipeline as far as I'm concerned. |
No reason, just need to find a reviewer. Can you take a look @apeters? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when I try and run tests locally, I get errors related to webpack.stats
OSError: Error reading /Users/alexei/Work/Projects/arches/shpo/arches/arches/webpack/webpack-stats.json.
Are you sure webpack has generated the file and the path is correct?
Yeah, you have to build yarn in the arches directory you're running the tests against. I'll update arches-docs with that. Let me know if that doesn't resolve it. EDIT: both yarn install && yarn start |
Will hold off on proposing a docs update, because an alternative would be just adding the missing file to version control (and leave it git-ignored in the project templates). The file just looks like this, give or take whether or not somebody has local_settings fiddling with STATIC_URL: {
"status": "compile",
"assets": {},
"chunks": {},
"publicPath": "/static/"
} |
|
||
# Teardown logic that runs to setup the class (runs only once) | ||
@classmethod | ||
def tearDownClass(cls): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason we removed the tearDownClass
method?
@@ -71,33 +63,6 @@ def setUpClass(cls): | |||
cursor = connection.cursor() | |||
cursor.execute(sql) | |||
|
|||
@classmethod | |||
def tearDownClass(cls): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason we removed the tearDownClass
method?
@@ -65,14 +56,6 @@ def setUpClass(cls): | |||
cursor = connection.cursor() | |||
cursor.execute(sql_str) | |||
|
|||
@classmethod | |||
def tearDownClass(cls): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason we removed the tearDownClass
method?
@@ -64,9 +64,6 @@ def setUp(self): | |||
}, | |||
) | |||
|
|||
def tearDown(self): | |||
self.history.delete() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we still be deleting this somewhere?
Yeah, good Q! Django wraps test cases in transactions, so you don't need to undo the changes you make to the test db -- each one just rolls back to the savepoint. (You might still need to run teardown code if you have other python changes (to module constants, settings, etc.), but these deleted teardown methods weren't doing that.) So at best, they're just cruft, but at worst, they can cause trouble:
|
Thanks for the very complete description of the issues and solutions. I guess I never realized that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still can't get the tests to complete fully. It seems to hang at some point and not finish, but that seems to be an issue for me without these improvements as well. I do see that the tests that do run (which are many), do run without any unnecessary output. Because of that I'll approve and try and figure out why I can't get tests to finish.
Types of changes
Description of Change
A few things make the test suite harder to work with when developing new tests, reviewing them, or debugging failing ones:
--
psycopg2.errors.ObjectInUse: cannot TRUNCATE "geojson_geometries" because it has pending trigger events
Now, the tests run quietly, so that failures can be seen at a glance. Also, the suite runs about twice as fast.
As part of this work, I noticed #10710 and solved it in an individual commit on this branch and added a release note.
Issues Solved
Closes #7186
Closes #10710
Checklist
Ticket Background
Further comments
To avoid contributing to this in the future, a couple things are worth noting:
self.assertLogs(...)
to capture the logged output and assert against itwith captured_stdout():
.