def test_find_package(self):
        # Given
        packages_definition = textwrap.dedent(u"""\
        dummy 1.0.1-1
        dummy_with_appinst 1.0.0-1
        dummy_with_entry_points 1.0.0-1
        dummy_with_proxy 1.3.40-3
        dummy_with_proxy_scripts 1.0.0-1
        dummy_with_proxy_softlink 1.0.0-1
        nose 1.2.1-1
        nose 1.3.0-1
        nose 1.3.0-2\
        """)
        packages = self.packages_from_definition(packages_definition)
        repository = Repository(packages)

        # When
        package = repository.find_package("nose", V("1.3.0-1"))

        # Then
        self.assertEqual(package.name, "nose")
        self.assertEqual(package.version, V("1.3.0-1"))
コード例 #2
0
    def test_find_package(self):
        # Given
        packages_definition = textwrap.dedent(u"""\
        dummy 1.0.1-1
        dummy_with_appinst 1.0.0-1
        dummy_with_entry_points 1.0.0-1
        dummy_with_proxy 1.3.40-3
        dummy_with_proxy_scripts 1.0.0-1
        dummy_with_proxy_softlink 1.0.0-1
        nose 1.2.1-1
        nose 1.3.0-1
        nose 1.3.0-2\
        """)
        packages = self.packages_from_definition(packages_definition)
        repository = Repository(packages)

        # When
        package = repository.find_package("nose", V("1.3.0-1"))

        # Then
        self.assertEqual(package.name, "nose")
        self.assertEqual(package.version, V("1.3.0-1"))
    def test_find_unavailable_package(self):
        # Given
        packages_definition = textwrap.dedent(u"""\
        dummy 1.0.1-1
        dummy_with_appinst 1.0.0-1
        dummy_with_entry_points 1.0.0-1
        dummy_with_proxy 1.3.40-3
        dummy_with_proxy_scripts 1.0.0-1
        dummy_with_proxy_softlink 1.0.0-1
        nose 1.2.1-1
        nose 1.3.0-1
        nose 1.3.0-2\
        """)
        packages = self.packages_from_definition(packages_definition)
        repository = Repository(packages)

        # When/Then
        with self.assertRaises(NoPackageFound):
            repository.find_package("nose", V("1.4.0-1"))

        repository.find_package("nose", V("1.3.0-1"))
        with self.assertRaises(NoPackageFound):
            repository.find_package("nono", V("1.3.0-1"))
コード例 #4
0
    def test_find_unavailable_package(self):
        # Given
        packages_definition = textwrap.dedent(u"""\
        dummy 1.0.1-1
        dummy_with_appinst 1.0.0-1
        dummy_with_entry_points 1.0.0-1
        dummy_with_proxy 1.3.40-3
        dummy_with_proxy_scripts 1.0.0-1
        dummy_with_proxy_softlink 1.0.0-1
        nose 1.2.1-1
        nose 1.3.0-1
        nose 1.3.0-2\
        """)
        packages = self.packages_from_definition(packages_definition)
        repository = Repository(packages)

        # When/Then
        with self.assertRaises(NoPackageFound):
            repository.find_package("nose", V("1.4.0-1"))

        repository.find_package("nose", V("1.3.0-1"))
        with self.assertRaises(NoPackageFound):
            repository.find_package("nono", V("1.3.0-1"))