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

DM-12117 check for old butler parents that are not nested #84

Merged
merged 1 commit into from Nov 28, 2017

Conversation

n8pease
Copy link
Contributor

@n8pease n8pease commented Nov 15, 2017

we started nesting Old Butler parent RepositoryCfgs to preserve
implicit arguments like what calib was used to load them. Some
repositoryCfg.yaml files exist where the Old Butler parent
repository is indicated only by path. This fix internally
converts that path to a RepositoryCfg and the root repository's
mapperArgs are also applied to the internal RepositoryCfg.

@parejkoj parejkoj changed the title check for old butler parents that are not nested DM-12117 check for old butler parents that are not nested Nov 15, 2017
Copy link
Contributor

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

See comments: I think checkCfgs might not be needed, and I gave a recommended way to restructure your test.

# whole RepositoryCfg, that described the Old Butler repository (including the mapperArgs that
# were used with it), was recorded as a "nested" repository cfg. That checkin did not account
# for the fact that there were repositoryCfg.yaml files in the world with only the path to
# Old Butler repositories in the parents list.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding a descriptive note about this block.

""".format(mapperArgs)

def test(self):
"""Test that an Old Butler parent repo that is can be loaded by a New Butler output repo and that the
Copy link
Contributor

Choose a reason for hiding this comment

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

"that is can be"?

Also, docstrings should be 79 char.

cfg._parents[i] = cfg._normalizeParents(cfg.root, [parentCfg])[0]


def checkCfgs(cfgList):
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not clear to me where this method gets used: it's not used in this commit anywhere. Also, it has no docstring.

dirty: true
""".format(mapperArgs)

def test(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

More descriptive method name than test: maybe test_oldButlerParents or something?

5. do the same, but specify a mapper arg, and verify that that mapper arg is passed to the parent as
well as the root repo.
"""
for mapperArgs in ({}, {'calib': 'foo'}):
Copy link
Contributor

Choose a reason for hiding this comment

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

Doing this as a for loop makes it hard to parse what's going on. I'd suggest writing a helper method _testSomething/checkSomething that takes mapperArgs and does what is inside the loop, and then unrolling the loop like this (if I'm interpreting it correctly):

def testSomething(self):
_testSomething({})
_testSomething({'calib':'foo'})

This will make test failures much easier to debug, since you won't have to figure out which loop is failing.

Actually, since you're calling tearDown manually at the bottom of this, I'd recommend just making each of the above calls its own test method: testSomethingDefaults and testSomethingCalib. Then tearDown will behave as expected. And the method docstring here can go up to the class level.

mapperArgs.get('calib'))
self.assertEqual(butler._repos.inputs()[1].repo._mapper.kwargs.get('calib'),
mapperArgs.get('calib'))
self.tearDown()
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't call tearDown manually.

@n8pease n8pease force-pushed the tickets/DM-12117 branch 2 times, most recently from 9971953 to 13c4198 Compare November 20, 2017 21:36
we started nesting Old Butler parent RepositoryCfgs to preserve
implicit arguments like what calib was used to load them. Some
repositoryCfg.yaml files exist where the Old Butler parent
repository is indicated only by path. This fix internally
converts that path to a RepositoryCfg and the root repository's
mapperArgs are also applied to the internal RepositoryCfg.
@n8pease n8pease merged commit ffa867f into master Nov 28, 2017
@ktlim ktlim deleted the tickets/DM-12117 branch August 25, 2018 06:14
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

2 participants