Esempio n. 1
0
    def test_find_failed_at_root(self):
        """Should return None if top-level directory has no project"""
        directory = os.path.dirname(os.path.realpath(__file__))
        subdirectory = os.path.join(directory, 'fake')

        with patch('os.path.dirname', return_value=subdirectory) as func:
            with self.assertRaises(FileNotFoundError):
                steptest.find_project_directory(subdirectory)
            func.assert_called_once_with(subdirectory)
Esempio n. 2
0
    def test_find_in_grandparent_path(self):
        """ should find a project in the grandparent directory """

        directory = os.path.dirname(os.path.realpath(__file__))
        subdirectory = os.path.join(directory, 'fake', 'fake')
        result = steptest.find_project_directory(subdirectory)
        self.assertEqual(directory, result)
Esempio n. 3
0
    def test_find_failed_at_root(self):
        """ should return None if top-level directory has no project """

        directory = os.path.dirname(os.path.realpath(__file__))
        subdirectory = os.path.join(directory, 'fake')

        with patch('os.path.dirname', return_value=subdirectory) as func:
            result = steptest.find_project_directory(subdirectory)
            func.assert_called_once_with(subdirectory)
        self.assertIsNone(result)
Esempio n. 4
0
 def test_find_in_grandparent_path(self):
     """Should find a project in the grandparent directory"""
     directory = os.path.dirname(os.path.realpath(__file__))
     subdirectory = os.path.join(directory, 'fake', 'fake')
     result = steptest.find_project_directory(subdirectory)
     self.assertEqual(directory, result)
Esempio n. 5
0
 def test_find_in_current_path(self):
     """Should find a project in this file's directory"""
     directory = os.path.dirname(os.path.realpath(__file__))
     result = steptest.find_project_directory(directory)
     self.assertEqual(directory, result)
Esempio n. 6
0
def test_find_in_parent_path():
    """Should find a project in the parent directory"""
    directory = os.path.dirname(os.path.realpath(__file__))
    subdirectory = os.path.join(directory, 'fake')
    result = steptest.find_project_directory(subdirectory)
    assert directory == result