def test_fetch_project_raises_runtime_error_only_if_project_dir_does_not_exist( self, expect_dir_exists, expect_runtime_error, ): # Arrange directory_env = Directory(join(os.getcwd(), 'my_project')) mock_os_path_isdir = self.patch('os.path.isdir') mock_os_path_isdir.return_value = expect_dir_exists self.patch('app.project_type.directory.node') # Act & Assert if expect_runtime_error: with self.assertRaises(RuntimeError): directory_env._fetch_project() else: directory_env._fetch_project()