def test_get_command_to_run_the_current_app_when_nocapture_is_set_to_true_in_config_file(
         self):
     current_dir = '/tmp/project_nocapture/example_app/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual(
         "/tmp/project_nocapture/manage.py test --nocapture example_app",
         command_to_run)
 def test_get_command_to_run_the_current_app_when_manage_py_found_and_app_name_and_env_specified(
         self):
     current_dir = '/tmp/project_app_name_and_env/example_app1/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual(
         "/tmp/project_app_name_and_env/manage.py test test example_app1",
         command_to_run)
 def test_get_command_to_run_the_current_app_when_manage_py_found_and_app_name_and_env_specified(self):
     current_dir = '/tmp/project_app_name_and_env/example_app1/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual("/tmp/project_app_name_and_env/manage.py test test example_app1", command_to_run)
 def test_get_command_to_rerun_last_tests_returns_the_command_last_used_to_run_tests(
         self):
     current_dir = '/tmp/project_app_only/example_app1/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     last_command = sut.get_command_to_rerun_last_tests()
     self.assertEqual(command_to_run, last_command)
 def test_get_command_to_run_current_app_writes_command_to_cache_file_when_successfully_called(
         self):
     current_dir = '/tmp/project_app_only/example_app1/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     last_command = self.get_cached_command()
     self.assertEqual(command_to_run, last_command)
 def test_get_command_to_run_the_current_app_when_config_file_not_present(self):
     current_dir = '/tmp/bad_dirs_no_config_file/Level1/Level2/Level3'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual(".vim-django file does not exist or is improperly formated. ':help run-django-tests'", command_to_run)
 def test_get_command_to_run_current_app_writes_command_to_cache_file_when_successfully_called(self):
     current_dir = '/tmp/project_app_only/example_app1/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     last_command = self.get_cached_command()
     self.assertEqual(command_to_run, last_command)
 def test_get_command_to_run_current_app_when_tests_are_in_a_nested_directory(self):
     current_dir = "/tmp/project_nested_test_dirs/example_app1/tests/nested1/test_nested_file.py"
     expected_return_value = "/tmp/project_nested_test_dirs/manage.py test example_app1"
     command_returned = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual(command_returned, expected_return_value)
 def test_get_command_to_run_the_current_app_when_multiple_apps_are_listed_and_a_valid_app_name_is_in_config_file(self):
     current_dir = "/tmp/project_multiple_apps/example_app1/tests/test_file.py"
     expected_return_value = "/tmp/project_multiple_apps/manage.py test example_app1"
     command_returned = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual(command_returned, expected_return_value)
 def test_get_command_to_run_the_current_app_when_manage_py_not_found(self):
     current_dir = '/tmp/bad_project_no_files/example_app1/tests/test_file.py'
     with self.assertRaises(sut.NotDjango):
         sut.get_command_to_run_the_current_app(current_dir)
 def test_get_command_to_run_the_current_app_when_config_file_not_present(
         self):
     current_dir = '/tmp/bad_project_no_config_file/example_app1/tests/test_file.py'
     with self.assertRaises(sut.NoVimDjango):
         sut.get_command_to_run_the_current_app(current_dir)
 def test_get_command_to_run_the_current_app_when_failfast_is_set_to_a_bad_value_in_config_file(self):
     current_dir = '/tmp/bad_project_failfast/example_app/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual("/tmp/bad_project_failfast/manage.py test example_app", command_to_run)
 def test_get_command_to_run_the_current_app_when_manage_py_not_found(self):
     current_dir = '/tmp/bad_project_no_files/example_app1/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual("Not Django", command_to_run)
 def test_get_command_to_run_the_current_app_when_config_file_not_present(self):
     current_dir = '/tmp/bad_project_no_config_file/example_app1/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     expected_return_value = ".vim-django does not exist"
     self.assertEqual(expected_return_value, command_to_run)
 def test_get_command_to_run_the_current_app_when_manage_py_not_found(self):
     current_dir = '/tmp/bad_dirs_no_files/Level1/Level2/Level3'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual("Are you sure this is a Django project?", command_to_run)
 def test_get_command_to_run_the_current_app_when_config_file_not_present(self):
     current_dir = '/tmp/bad_project_no_config_file/example_app1/tests/test_file.py'
     with self.assertRaises(sut.NoVimDjango):
         sut.get_command_to_run_the_current_app(current_dir)
 def test_get_command_to_run_the_current_app_when_manage_py_not_found(self):
     current_dir = '/tmp/bad_project_no_files/example_app1/tests/test_file.py'
     with self.assertRaises(sut.NotDjango):
         sut.get_command_to_run_the_current_app(current_dir)
 def test_get_command_to_run_the_current_app_when_multiple_apps_are_listed_and_a_valid_app_name_is_in_config_file(
         self):
     current_dir = "/tmp/project_multiple_apps/example_app1/tests/test_file.py"
     expected_return_value = "/tmp/project_multiple_apps/manage.py test example_app1"
     command_returned = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual(command_returned, expected_return_value)
 def test_get_command_to_run_the_current_app_when_multiple_apps_are_listed_and_a_valid_app_name_is_not_in_config_file(self):
     current_dir = "/tmp/bad_project_multiple_invalid_apps/example_app1/tests/test_file.py"
     with self.assertRaises(sut.NoVimDjango):
         sut.get_command_to_run_the_current_app(current_dir)
 def test_get_command_to_run_the_current_app_when_multiple_apps_are_listed_and_a_valid_app_name_is_not_in_config_file(
         self):
     current_dir = "/tmp/bad_project_multiple_invalid_apps/example_app1/tests/test_file.py"
     with self.assertRaises(sut.NoVimDjango):
         sut.get_command_to_run_the_current_app(current_dir)
 def test_get_command_to_run_the_current_app_when_nocapture_is_set_to_true_in_config_file(self):
     current_dir = '/tmp/project_nocapture/example_app/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual("/tmp/project_nocapture/manage.py test --nocapture example_app", command_to_run)
 def test_get_command_to_run_current_app_when_tests_are_in_a_nested_directory(
         self):
     current_dir = "/tmp/project_nested_test_dirs/example_app1/tests/nested1/test_nested_file.py"
     expected_return_value = "/tmp/project_nested_test_dirs/manage.py test example_app1"
     command_returned = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual(command_returned, expected_return_value)
 def test_get_command_to_rerun_last_tests_returns_the_command_last_used_to_run_tests(self):
     current_dir = '/tmp/project_app_only/example_app1/tests/test_file.py'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     last_command = sut.get_command_to_rerun_last_tests()
     self.assertEqual(command_to_run, last_command)
 def test_get_command_to_run_the_current_app_when_manage_py_found_and_app_name_and_env_specified(self):
     current_dir = '/tmp/good_dirs_app_name_and_env_defined/Level1/Level2/Level3'
     command_to_run = sut.get_command_to_run_the_current_app(current_dir)
     self.assertEqual(":!python /tmp/good_dirs_app_name_and_env_defined/manage.py test test example_app", command_to_run)