def test_empty_file(self):
        """
        Test that script works with an empty requirements file
        """
        packages = parse_requirements_file(open(os.path.join(BASE_PATH, 'files/requirements_empty.txt')))

        self.assertEqual(len(packages), 0)
    def test_file_with_repo_links(self):
        """
        Test that repository links are skipped
        """
        packages = parse_requirements_file(open(os.path.join(BASE_PATH, 'files/requirements_repos.txt')))

        # packages should only include the gitconfig package
        self.assertEqual(len(packages), 1)
    def test_file_with_comments(self):
        """
        Test that a requirements file with comments does not throw errors
        """
        packages = parse_requirements_file(open(os.path.join(BASE_PATH, 'files/requirements_comments.txt')))

        # The file has one package, Django
        self.assertEqual(len(packages), 1)
Example #4
0
    def test_empty_file(self):
        """
        Test that script works with an empty requirements file
        """
        with open(os.path.join(BASE_PATH, 'files/requirements_empty.txt')) as f:
            packages = parse_requirements_file(f)

        self.assertEqual(len(packages), 0)
Example #5
0
    def test_file_with_repo_links(self):
        """
        Test that repository links are skipped
        """
        with open(os.path.join(BASE_PATH, 'files/requirements_repos.txt')) as f:
            packages = parse_requirements_file(f)

        # packages should only include the gitconfig package
        self.assertEqual(len(packages), 1)
Example #6
0
    def test_file_with_comments(self):
        """
        Test that a requirements file with comments does not throw errors
        """
        with open(os.path.join(BASE_PATH, 'files/requirements_comments.txt')) as f:
            packages = parse_requirements_file(f)

        # The file has one package, Django
        self.assertEqual(len(packages), 1)
Example #7
0
    def test_file_with_no_version(self):
        """
        Check a package with no version, should skip
        """
        with open(os.path.join(BASE_PATH,
                               'files/requirements_unpinned.txt')) as f:
            packages = parse_requirements_file(f)

        self.assertEqual(len(packages), 0)