Skip to content

Commit

Permalink
Fix tests/test_utils.py (hopefully)
Browse files Browse the repository at this point in the history
Tests keep running on my machine but fail on Travis...
  • Loading branch information
riccardomurri committed Aug 11, 2017
1 parent 00dc086 commit b672e3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gc3libs/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# test definitions

def test_get_linux_memcg_limit_no_proc_self_cgroup():
with mock.patch('gc3libs.utils.open') as mo:
with mock.patch('__builtin__.open') as mo:
mo.side_effect = OSError(2, 'No such file or directory', '/proc/self/cgroup')
limit = gc3libs.utils.get_linux_memcg_limit()
mo.assert_called_once_with('/proc/self/cgroup', 'r')
Expand All @@ -45,7 +45,7 @@ def test_get_linux_memcg_limit_no_proc_self_cgroup():

def test_get_linux_memcg_limit_no_memcg():
mo = mock.mock_open(read_data='*** no memcg ***')
with mock.patch('gc3libs.utils.open', mo):
with mock.patch('__builtin__.open', mo):
limit = gc3libs.utils.get_linux_memcg_limit()
mo.assert_called_once_with('/proc/self/cgroup', 'r')
assert limit is None
Expand All @@ -66,7 +66,7 @@ def fake_open(path, mode):
raise AssertionError(
"Unexpected call to open({0!r}, {1!r})"
.format(path, mode))
with mock.patch('gc3libs.utils.open') as mo:
with mock.patch('__builtin__.open') as mo:
mo.side_effect = fake_open
limit = gc3libs.utils.get_linux_memcg_limit()
mo.assert_has_calls([
Expand Down

0 comments on commit b672e3d

Please sign in to comment.