extends must be copied from override file#2206
Conversation
There was a problem hiding this comment.
It's not immediately clear why you're doing this? How does creating a temporary directory fit into the description of what this test is doing around extends? Could this have been achieved with a fixture?
There was a problem hiding this comment.
Could this have been achieved with a fixture?
If we go with the py.test way of doing fixtures, maybe. With unittest fixtures, no.
Fixtures are just "common test setup", but there is always other test setup that isn't all that common. This is just setting up the environment so the test exercises the expected functionality.
It's creating a common.yml which is referenced from the config above.
I'm not sure how to make this more clear.
There was a problem hiding this comment.
Added more detail to the PR description about why this is different
|
I'm LGTM for both code and adopting the new testing approach. I understand now and can see the benefit of having the detail of what you're testing inline with the test. |
|
@aanand are you cool with the direction of this testing approach? |
|
Yeah, I like it. Fixtures are good in that an actual directory with actual files is nice and easy to understand, but I never liked the coupling-at-a-distance. |
|
Ya, I think for end-to-end tests having the files could be good, but for unit tests it's easier to just do it inline. Most of our files exist for our integration tests. I think there are only a couple used by unit tests. |
64f95c8 to
938d49c
Compare
Signed-off-by: Daniel Nephin <dnephin@docker.com>
|
Rebased |
extends must be copied from override file
Fixes #2205
merge_service_dicts()which is used for extends doesn't copy extends, but we need to copy extends for overriding of files.In the test for this fix I've used a
tempdirfor creating the necessary file instead of using a real file. I think this makes the test easier to understand because the fixtures are inline, instead of a separate file.If we're happy with this approach, I think we could convert a few of our other unit tests to use this setup.