|
|
@ -15,14 +15,12 @@ from pyfakefs.fake_filesystem import FakeFileOpen
|
|
|
|
import dotdot
|
|
|
|
import dotdot
|
|
|
|
import fake_env
|
|
|
|
import fake_env
|
|
|
|
|
|
|
|
|
|
|
|
from pubs import pubs_cmd, update, color, content, filebroker, uis, p3, endecoder
|
|
|
|
from pubs import pubs_cmd, color, content, uis, p3, endecoder
|
|
|
|
from pubs.config import conf
|
|
|
|
from pubs.config import conf
|
|
|
|
import configobj
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import str_fixtures
|
|
|
|
import str_fixtures
|
|
|
|
import fixtures
|
|
|
|
import fixtures
|
|
|
|
|
|
|
|
|
|
|
|
from pubs.commands import init_cmd, import_cmd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# makes the tests very noisy
|
|
|
|
# makes the tests very noisy
|
|
|
|
PRINT_OUTPUT = False
|
|
|
|
PRINT_OUTPUT = False
|
|
|
@ -68,10 +66,10 @@ class TestInput(unittest.TestCase):
|
|
|
|
ui = uis.InputUI(sample_conf)
|
|
|
|
ui = uis.InputUI(sample_conf)
|
|
|
|
|
|
|
|
|
|
|
|
other_input = fake_env.FakeInput(['yes', 'no'],
|
|
|
|
other_input = fake_env.FakeInput(['yes', 'no'],
|
|
|
|
module_list=[uis, color])
|
|
|
|
module_list=[uis])
|
|
|
|
other_input.as_global()
|
|
|
|
other_input.as_global()
|
|
|
|
self.assertEqual(ui.editor_input(), 'yes')
|
|
|
|
self.assertEqual(ui.editor_input('fake_editor'), 'yes')
|
|
|
|
self.assertEqual(ui.editor_input(), 'no')
|
|
|
|
self.assertEqual(ui.editor_input('fake_editor'), 'no')
|
|
|
|
with self.assertRaises(fake_env.FakeInput.UnexpectedInput):
|
|
|
|
with self.assertRaises(fake_env.FakeInput.UnexpectedInput):
|
|
|
|
ui.editor_input()
|
|
|
|
ui.editor_input()
|
|
|
|
|
|
|
|
|
|
|
@ -84,7 +82,6 @@ class CommandTestCase(fake_env.TestFakeFs):
|
|
|
|
def setUp(self, nsec_stat=True):
|
|
|
|
def setUp(self, nsec_stat=True):
|
|
|
|
super(CommandTestCase, self).setUp()
|
|
|
|
super(CommandTestCase, self).setUp()
|
|
|
|
os.stat_float_times(nsec_stat)
|
|
|
|
os.stat_float_times(nsec_stat)
|
|
|
|
# self.fs = fake_env.create_fake_fs([content, filebroker, conf, init_cmd, import_cmd, configobj, update], nsec_stat=nsec_stat)
|
|
|
|
|
|
|
|
self.default_pubs_dir = os.path.expanduser('~/.pubs')
|
|
|
|
self.default_pubs_dir = os.path.expanduser('~/.pubs')
|
|
|
|
self.default_conf_path = os.path.expanduser('~/.pubsrc')
|
|
|
|
self.default_conf_path = os.path.expanduser('~/.pubsrc')
|
|
|
|
|
|
|
|
|
|
|
@ -180,7 +177,7 @@ class URLContentTestCase(DataCommandTestCase):
|
|
|
|
return p3.urlparse(url).path
|
|
|
|
return p3.urlparse(url).path
|
|
|
|
|
|
|
|
|
|
|
|
def url_exists(self, url):
|
|
|
|
def url_exists(self, url):
|
|
|
|
return self.fs.Exists(self._url_to_path(url))
|
|
|
|
return self.fs.exists(self._url_to_path(url))
|
|
|
|
|
|
|
|
|
|
|
|
def url_to_byte_content(self, url, ui=None):
|
|
|
|
def url_to_byte_content(self, url, ui=None):
|
|
|
|
path = self._url_to_path(url)
|
|
|
|
path = self._url_to_path(url)
|
|
|
@ -922,4 +919,4 @@ class TestCache(DataCommandTestCase):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|
|
|
|
unittest.main(verbosity=2)
|
|
|
|