Skip to content

Instantly share code, notes, and snippets.

@Ram-Z
Last active August 29, 2015 14:15
Show Gist options
  • Save Ram-Z/4d3b64f2666f6b6af12b to your computer and use it in GitHub Desktop.
Save Ram-Z/4d3b64f2666f6b6af12b to your computer and use it in GitHub Desktop.
(.venv) [12:00 ramsi@shada <master*>]% python3 -m unittest ~src/qutebrowser
..s...........................x.....................s.........................................................................................................................................................F......EE..................................x..............................................................................................................................................................................................................................................................................................s.s.ss.......................F.F.F.sss..........................................................................................................
======================================================================
ERROR: test_validate_expanduser (qutebrowser.test.config.test_configtypes.DirectoryTests)
Test if validate expands the user correctly.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.4/unittest/mock.py", line 1136, in patched
return func(*args, **keywargs)
File "/home/ramsi/src/qutebrowser/qutebrowser/test/config/test_configtypes.py", line 1391, in test_validate_expanduser
self.t.validate('~/foobar')
File "/home/ramsi/src/qutebrowser/qutebrowser/config/configtypes.py", line 843, in validate
raise configexc.ValidationError(value, "must be a valid "
qutebrowser.config.configexc.ValidationError: Invalid value '<MagicMock name='path.expandvars().replace()' id='140495713844752'>' - must be a valid directory!
======================================================================
ERROR: test_validate_expandvars (qutebrowser.test.config.test_configtypes.DirectoryTests)
Test if validate expands the user correctly.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.4/unittest/mock.py", line 1136, in patched
return func(*args, **keywargs)
File "/home/ramsi/src/qutebrowser/qutebrowser/test/config/test_configtypes.py", line 1383, in test_validate_expandvars
self.t.validate('$$FOO/foobar')
File "/home/ramsi/src/qutebrowser/qutebrowser/config/configtypes.py", line 843, in validate
raise configexc.ValidationError(value, "must be a valid "
qutebrowser.config.configexc.ValidationError: Invalid value '<MagicMock name='path.expanduser()' id='140495714018360'>' - must be a valid directory!
======================================================================
FAIL: test_transform (qutebrowser.test.config.test_configtypes.DirectoryTests)
Test transform.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.4/unittest/mock.py", line 1136, in patched
return func(*args, **keywargs)
File "/home/ramsi/src/qutebrowser/qutebrowser/test/config/test_configtypes.py", line 1397, in test_transform
self.assertEqual(self.t.transform('~/foobar'), '/home/foo/foobar')
AssertionError: <MagicMock name='path.expandvars().replace()' id='140496923260408'> != '/home/foo/foobar'
======================================================================
FAIL: test_cache (qutebrowser.test.utils.test_standarddir.GetStandardDirLinuxTests)
Test cache dir with XDG_CACHE_HOME not set.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ramsi/src/qutebrowser/qutebrowser/test/utils/test_standarddir.py", line 96, in test_cache
'qutebrowser'))
AssertionError: '/home/ramsi/.cache/qutebrowser' != '/tmp/tmp4_gyr2zs/.cache/qutebrowser'
- /home/ramsi/.cache/qutebrowser
+ /tmp/tmp4_gyr2zs/.cache/qutebrowser
======================================================================
FAIL: test_config (qutebrowser.test.utils.test_standarddir.GetStandardDirLinuxTests)
Test config dir with XDG_CONFIG_HOME not set.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ramsi/src/qutebrowser/qutebrowser/test/utils/test_standarddir.py", line 88, in test_config
'qutebrowser'))
AssertionError: '/home/ramsi/.config/qutebrowser' != '/tmp/tmpj6d2v__d/.config/qutebrowser'
- /home/ramsi/.config/qutebrowser
+ /tmp/tmpj6d2v__d/.config/qutebrowser
======================================================================
FAIL: test_data (qutebrowser.test.utils.test_standarddir.GetStandardDirLinuxTests)
Test data dir with XDG_DATA_HOME not set.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ramsi/src/qutebrowser/qutebrowser/test/utils/test_standarddir.py", line 79, in test_data
'share', 'qutebrowser'))
AssertionError: '/home/ramsi/.local/share/qutebrowser' != '/tmp/tmpmf7pavj1/.local/share/qutebrowser'
- /home/ramsi/.local/share/qutebrowser
? ^^ ^ ^ ^^^
+ /tmp/tmpmf7pavj1/.local/share/qutebrowser
? ^ ^ ^^^^^^^ ^^^
----------------------------------------------------------------------
Ran 680 tests in 0.866s
FAILED (failures=4, errors=2, skipped=9, expected failures=2)
def test_validate_expandvars(self, os_path):
"""Test if validate expands the user correctly."""
os_path.expandvars.side_effect = lambda x: x.replace('$FOO', '/home/foo')
os_path.isdir.side_effect = lambda path: path == '/home/foo/foobar'
os_path.isabs.return_value = True
self.t.validate('$$FOO/foobar')
os_path.expandvars.assert_called_once_with('$FOO/foobar')
def test_validate_expanduser(self, os_path):
"""Test if validate expands the user correctly."""
os_path.expanduser.side_effect = lambda x: x.replace('~', '/home/foo')
os_path.isdir.side_effect = lambda path: path == '/home/foo/foobar'
os_path.isabs.return_value = True
self.t.validate('~/foobar')
os_path.expanduser.assert_called_once_with('~/foobar')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment