Exemplo n.º 1
0
 def test_add_pwd(self, *args):
     gcwd, execute_from_command_line = args
     with mock.patch("sys.path", new=[]) as path:
         cli.otree_cli()
         self.assertEquals(path, ["foo"])
     self.assertTrue(gcwd.called)
     execute_from_command_line.assert_called_with(["--version"], "otree")
Exemplo n.º 2
0
 def test_add_pwd(self, *args):
     gcwd, execute_from_command_line = args
     with mock.patch("sys.path", new=[]) as path:
         cli.otree_cli()
         self.assertEquals(path, ["foo"])
     self.assertTrue(gcwd.called)
     execute_from_command_line.assert_called_with(["--version"], 'otree')
Exemplo n.º 3
0
 def test_import_settings_fail(self, *args):
     settings_patch = mock.patch("otree.management.cli.settings",
                                 create=True)
     with settings_patch as settings:
         type(settings).INSTALLED_APPS = mock.PropertyMock(
             side_effect=ImportError)
         with self.assertRaises(SystemExit):
             cli.otree_cli()
Exemplo n.º 4
0
 def test_import_settings_fail(self, *args):
     settings_patch = mock.patch(
         "otree.management.cli.settings",
         create=True)
     with settings_patch as settings:
         type(settings).INSTALLED_APPS = mock.PropertyMock(
             side_effect=ImportError)
         with self.assertRaises(SystemExit):
             cli.otree_cli()
Exemplo n.º 5
0
 def run(self):
     try:
         with cd(self._path), mock.patch("sys.argv", ["", "check"]):
             with mock.patch("sys.stdout"), \
                     mock.patch("warnings.warn"), \
                     mock.patch("otree.management.cli.pypi_updates_cli"):
                 from otree.management import cli
                 cli.otree_cli()
             result = self._func()
     except Exception as err:
         result = err
     serialized = pickle.dumps(result)
     self._queue.put(serialized)
Exemplo n.º 6
0
 def test_clean_run(self, execute_from_command_line):
     cli.otree_cli()
     execute_from_command_line.assert_called_with(["--help"], "otree")
Exemplo n.º 7
0
 def test_clean_run(self, execute_from_command_line):
     cli.otree_cli()
     execute_from_command_line.assert_called_with(["--help"], 'otree')
Exemplo n.º 8
0
 def test_import_settings_fail(self, *args):
     with mock.patch("django.conf.settings", create=True) as settings:
         type(settings).INSTALLED_APPS = mock.PropertyMock(
             side_effect=ImportError)
         with self.assertRaises(SystemExit):
             cli.otree_cli()