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

[2019.2] Fixing unit.test_loader.LoaderGlobalsTest.test_states test #53224

Merged

Conversation

garethgreenaway
Copy link
Contributor

@garethgreenaway garethgreenaway commented May 23, 2019

What does this PR do?

Fixing unit.test_loader.LoaderGlobalsTest.test_states test

What issues does this PR fix or reference?

#53014

Previous Behavior

Test fails.

New Behavior

Test succeeds.

Tests written?

No. Fixing existing test.

Commits signed with GPG?

Yes/No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@garethgreenaway garethgreenaway requested a review from a team May 23, 2019 19:35
Copy link
Contributor

@DmitryKuzmenko DmitryKuzmenko left a comment

Choose a reason for hiding this comment

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

I'm ok with one change request.


# get the names of the globals you should have
func_name = inspect.stack()[1][3]
names = next(six.itervalues(salt.utils.yaml.safe_load(getattr(self, func_name).__doc__)))

# Now, test each module!
for item in global_vars:
for item in six.itervalues(global_vars):
for name in names:
self.assertIn(name, list(item.keys()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

self.assertIn(name, list(item))

Or even

self.assertIn(name, item)

Less intermediary objects...

@twangboy twangboy merged commit 063ea3c into saltstack:2019.2 May 23, 2019
@krionbsd krionbsd mentioned this pull request Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants