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
DM-3904: Pytest updates #40
Conversation
Group imports in the standard way. Put all imports at the top. If only a few symbols imported, import them explicitly Spell out lsst.utils.tests instead of using utilsTests
Set up an environment variable in setUpClass instead of globally Replace "if __name__ == "__main__" with the standard replacement
Modernize the way the test is run. Use "with assertRaises(...):" instead of "self.assertRaises(...)"
|
||
if __name__ == "__main__": | ||
run(True) | ||
lsst.utils.tests.init() | ||
unittest.main() |
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.
newline is missing.
154acf6
to
3de6a57
Compare
print >> fd, s.getId(), s.getXAstrom(), s.getYAstrom(), s.getRa(), s.getDec(), s.getPsfFlux(), s.getFlagForDetection() | ||
print >> fd, s.getId(), s.getXAstrom(), s.getYAstrom(), s.getRa( | ||
), s.getDec(), s.getPsfFlux(), s.getFlagForDetection() | ||
|
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 don't know that this block is more readable autopep8...
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.
No. It broke at the wrong place and it probably didn't need to break at all for 110 character limit.
Modernize the way it is run for better pytest compatibility. Change self.assertRaises to a "with self.assertRaises"
Replaced one assertTrue with assertIsNone
Don't use utilsTest namespace abbreviation
Remove leading blank line
Change "self.assertRaises(..." to "with self.assertRaises(..."
Use lsst.utils.tests without a namespace abbreviation
Import lsst.utils.tests instead of using namespace abbrev.
Modernize the way the test is run. Only have the classes that need to be run inherit from TestCase
Change assertTrue(foo in bar) with assertIn(foo, bar)
Import lsst.utils.tests without namespace abbreviation Use from foo import bar when only a few symbols imported
Change "self.assertRaises..." to "with self.assertRaises..."
Also change module global to local
Standardize the way ASTROMETRY_NET_DATA_DIR is set by tests, and make sure it is always done in setUp
3de6a57
to
50f45d8
Compare
No description provided.