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

Some unit tests fixes #36227

Merged
merged 2 commits into from
Sep 12, 2016
Merged

Conversation

meaksh
Copy link
Contributor

@meaksh meaksh commented Sep 12, 2016

What does this PR do?

This PR fixes some unit tests and prevents errors in some cases:

In cases where /etc/fstab does not exists:

unit/modules/mount_test.py::MountTestCase::test_rm_fstab FAILED
salt/modules/mount.py:333: CommandExecutionError: Couldn't read from /etc/fstab: [Errno 2] No such file or directory: '/etc/fstab'
...
tests/unit/states/file_test.py::FileTestCase::test_comment FAILED
tests/unit/states/file_test.py:956: AssertionError: {'comment': '/etc/fstab: file not found', 'changes': {[36 chars]alse} != {'comment': 'Pattern already commented', 'name': '/etc[34 chars]True}
tests/unit/states/file_test.py:1015: AssertionError: {'comment': '/etc/fstab: file not found', 'changes': {[36 chars]alse} != {'comment': 'Pattern already uncommented', 'name': '/e[36 chars]True}

Sometimes HAS_BOTO wrongly responses True even if boto module does not exists. I think it's because from __future__ import absolute_import causes that when doing import boto it does not raise ImportError as it imports utils/boto.py:

ERROR collecting unit/modules/boto_secgroup_test.py
salt-2015.8.7/tests/unit/modules/boto_secgroup_test.py:96: in <module>
    @skipIf(_has_required_boto() is False, 'The boto module must be greater than'
salt-2015.8.7/tests/unit/modules/boto_secgroup_test.py:87: in _has_required_boto
    elif LooseVersion(boto.__version__) < LooseVersion(required_boto_version):
E   AttributeError: 'module' object has no attribute '__version__'

This changes should be also included in 2016.3 and develop
Thanks!

@rallytime
Copy link
Contributor

Hrm. Something is off on this test run. I'll restart it.

@rallytime
Copy link
Contributor

Go Go Jenkins!

@rallytime
Copy link
Contributor

Thanks @meaksh

@rallytime rallytime merged commit fdf4090 into saltstack:2015.8 Sep 12, 2016
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