Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Use deduced_required value for config.push #145

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

oyvindeide
Copy link
Contributor

No description provided.

self.assertEqual(first.heroes, second.heroes)
self.assertEqual(sorted(first.villains), sorted(second.villains))

def test_push_deduced_required(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are already tests on push in test_layers.py. Should we move this test over in that file? Or potentially move all tests on push into this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might make sense to move it, my main problem is that this isn´t a failing test, although I first thought it would be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So just to clarify for me a bit, because containers can no longer be required, must the programmer add a custom validation to make sure they are specified?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, that should be fixed first! In that respect it might make sense to move it to test_depreation_warning.py. You should be able to build on one of the tests there to verify that deduce_required also is active after a push?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will push an actual failing test in a sec

DanSava
DanSava previously approved these changes Jun 4, 2020
Copy link
Contributor

@DanSava DanSava left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@DanSava DanSava dismissed their stale review June 4, 2020 13:11

Markus suggeted some changes

@markusdregi
Copy link
Collaborator

So just to clarify for me a bit, because containers can no longer be required, must the programmer add a custom validation to make sure they are specified?

Depends on what the programmer is after... A defaulted, empty container will be specified for lists and dicts, and for named dicts all fields will be defaulted (unless some cannot be defaulted validly, in which case an error will occur). If you want a different behaviour than this, you will need to do custom validation at the moment.

@oyvindeide oyvindeide force-pushed the add_deduced_on_push branch 2 times, most recently from 1b2f4a0 to c14d231 Compare June 4, 2020 13:52
@oyvindeide
Copy link
Contributor Author

Test is updated, will try to find a more suitable place for it.

basic_config = basic_config.push({"not_required": 10})
self.assertTrue(basic_config.valid)

self.assertTrue(basic_config._deduce_required)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You'll need to test the consequence of this, not the deduce_required field itself. Pylint will not allow it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, well, am already doing that as the config would be invalid without the change. Think that should be enough.

@markusdregi
Copy link
Collaborator

will try to find a more suitable place for it

My preference is test_deprecation_warning.py (which is what you'll have to inspect to detect whether the property is propagated or not anyway). Because then all the tests that needs to be updated on the journey from 0.6 -> 0.7 -> 0.8 with respect to facing out Required is present in the same file 😬

@oyvindeide
Copy link
Contributor Author

oyvindeide commented Jun 4, 2020

By the way:
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
NM, saw this now #130

@oyvindeide oyvindeide self-assigned this Jun 4, 2020
Copy link
Collaborator

@markusdregi markusdregi left a comment

Choose a reason for hiding this comment

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

Looks good 👍 Thank you for the contribution

@markusdregi markusdregi merged commit 2e12533 into equinor:master Jun 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants