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

file state test fixes #49240

Merged
merged 2 commits into from Aug 22, 2018

Conversation

Projects
None yet
3 participants
@dwoz
Contributor

dwoz commented Aug 21, 2018

  • fix integration.states.test_file.FileTest.test_managed_latin1_diff
  • fix integration.states.test_file.FileTest.test_recurse_issue_40578
  • fix some issues integration.states.test_file.FileTest.test_issue_8947_utf8_sls,
    this test still fails due to py2 popen's unicode handling.

Tests written?

No - Fixing existing tests

Commits signed with GPG?

Yes

file state test fixes
- fix integration.states.test_file.FileTest.test_managed_latin1_diff
- fix integration.states.test_file.FileTest.test_recurse_issue_40578
- fix some issues integration.states.test_file.FileTest.test_issue_8947_utf8_sls,
  this test still fails due to py2 popen's unicode handling.

@dwoz dwoz requested review from terminalmage and Ch3LL Aug 21, 2018

@terminalmage

One of the changes here will break the test on MacOS, so I need some more information so we can choose a better fix here.

self.assertEqual(
sorted(salt.utils.data.decode(os.listdir(name), normalize=True)),
sorted(os.listdir(name.decode('utf-8'))),

This comment has been minimized.

@terminalmage

terminalmage Aug 21, 2018

Member

This will break the test on MacOS. We need to normalize the unicode in the os.listdir() results, because MacOS/HFS+ uses different unicode codepoints to produce the same glyphs.

Also, I'm not sure why using salt.utils.data.decode() to decode the filenames would use the system encoding, since it calls salt.utils.stringutils.to_unicode() under the hood, and that will try UTF8 first before trying the system encoding. Is there something I'm missing?

This comment has been minimized.

@dwoz

dwoz Aug 21, 2018

Contributor

For py2 windows, If we pass bytes to os.listdir it will use the system encoding to try and return bytes. I think we just need to make this a special case for PY2 windows for now.

This comment has been minimized.

@terminalmage

terminalmage Aug 21, 2018

Member

OK cool, I agree then. I'll re-review once you've had a chance to make the change, other than this one thing everything else looked good to merge.

@dwoz dwoz merged commit 4634752 into saltstack:2018.3 Aug 22, 2018

5 of 8 checks passed

continuous-integration/jenkins/pr-merge This commit cannot be built
Details
jenkins/pr/py2-centos-7 The py2-centos-7 job has failed
Details
jenkins/pr/py3-centos-7 The py3-centos-7 job has failed
Details
WIP ready for review
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint The lint job has passed
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has passed
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
Details

rallytime added a commit that referenced this pull request Aug 28, 2018

rallytime added a commit that referenced this pull request Aug 30, 2018

@dwoz dwoz deleted the dwoz:state_tests branch Sep 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment