def test_fills_proper_index(self): """ Verify that pure packages are uploaded to the pure index non-pure packages are uploaded to the normal index. """ user = '******' with devpi_server() as server_url: with devpi_index(server_url, user, 'binary') as (binary_index, password): with devpi_index(server_url, user, 'pure', password) as (pure_index, _): main([ 'tests/fixture/sample_pure_and_non-pure.txt', binary_index, user, password, '--pure-index={}'.format(pure_index) ]) with devpi.Client(pure_index) as client: self.assertTrue( client.package_version_exists( 'progressbar', '2.2')) self.assertFalse( client.package_version_exists('PyYAML', '3.10')) with devpi.Client(binary_index) as client: self.assertFalse( client.package_version_exists( 'progressbar', '2.2')) self.assertTrue( client.package_version_exists('PyYAML', '3.10'))
def test_not_built_if_on_pure(self): """ Verify that packages are not built and re-uploaded if they are already on the pure index. """ pure_user = '******' with devpi_server() as server_url: with devpi_index(server_url, 'destination', 'wheels') as (destination_index, _): with devpi_index(server_url, pure_user, 'pure') as (pure_index, pure_password): with devpi.Client(pure_index, pure_user, pure_password) as client: client.upload( 'tests/fixture/pure_package/dist/test_package-0.1_dev-py2.py3-none-any.whl' ) with patch.object(wheeler.Builder, 'build', autospec=True, side_effect=Exception( 'Should not build!')) as mock_build: main([ 'tests/fixture/sample_test_package.txt', destination_index, pure_user, pure_password, '--pure-index={}'.format(pure_index) ]) self.assertFalse(mock_build.called)
def test_not_built_if_on_pure(self): """ Verify that packages are not built and re-uploaded if they are already on the pure index. """ pure_user = '******' with devpi_server() as server_url: with devpi_index(server_url, 'destination', 'wheels') as (destination_index, _): with devpi_index(server_url, pure_user, 'pure') as (pure_index, pure_password): with devpi.Client(pure_index, pure_user, pure_password) as client: client.upload('tests/fixture/pure_package/dist/test_package-0.1_dev-py2.py3-none-any.whl') with patch.object(wheeler.Builder, 'build', autospec=True, side_effect=Exception('Should not build!')) as mock_build: main(['tests/fixture/sample_test_package.txt', destination_index, pure_user, pure_password, '--pure-index={}'.format(pure_index) ]) self.assertFalse(mock_build.called)
def test_reports_junit_xml(self): user = '******' with devpi_server() as server_url, devpi_index( server_url, user, 'wheels') as (destination_index, password): with devpi.Client(destination_index, user, password) as client: client.upload( 'tests/fixture/pure_package/dist/test_package-0.1_dev-py2.py3-none-any.whl' ) tempdir = tempfile.mkdtemp() try: junit_filename = os.path.join(tempdir, 'junit.xml') main([ 'tests/fixture/sample_junit.txt', destination_index, user, password, '--junit-xml', junit_filename ]) root = ET.parse(junit_filename) ET.dump(root) self._assert_test_case( root, 'failure', 'package-that-hopefully-not-exists 99.999') self._assert_test_case(root, 'skipped', 'test-package 0.1-dev') pb_elems = root.findall(".//testcase[@name='progressbar 2.2']") self.assertEqual(1, len(pb_elems)) pb_elem = pb_elems[0] self.assertIsNone(pb_elem.find('failure')) self.assertIsNone(pb_elem.find('error')) self.assertIsNone(pb_elem.find('skipped')) finally: shutil.rmtree(tempdir)
def test_continue_on_failed(self): user = '******' with devpi_server() as server_url, devpi_index(server_url, user, 'wheels') as (destination_index, password): main(['tests/fixture/sample_continue_on_failed.txt', destination_index, user, password]) with devpi.Client(destination_index) as devpi_client: self.assertTrue(devpi_client.package_version_exists('progressbar', '2.2'))
def test_continue_on_failed(self): user = "******" with devpi_server() as server_url, devpi_index(server_url, user, "wheels") as (destination_index, password): main(["tests/fixture/sample_continue_on_failed.txt", destination_index, user, password]) with devpi.Client(destination_index) as devpi_client: self.assertTrue(devpi_client.package_version_exists("progressbar", "2.2"))
def test_with_blacklist(self): user = '******' with devpi_server() as server_url, devpi_index(server_url, user, 'wheels') as (destination_index, password): main(['tests/fixture/sample_simple.txt', destination_index, user, password, '--blacklist={}'.format('tests/fixture/sample_no_version.txt')]) with devpi.Client(destination_index) as devpi_client: self.assertFalse(devpi_client.package_version_exists('progressbar', '2.2')) self.assertTrue(devpi_client.package_version_exists('six', '1.7.3'))
def test_fills_proper_index(self): """ Verify that pure packages are uploaded to the pure index non-pure packages are uploaded to the normal index. """ user = '******' with devpi_server() as server_url: with devpi_index(server_url, user, 'binary') as (binary_index, password): with devpi_index(server_url, user, 'pure', password) as (pure_index, _): main(['tests/fixture/sample_pure_and_non-pure.txt', binary_index, user, password, '--pure-index={}'.format(pure_index) ]) with devpi.Client(pure_index) as client: self.assertTrue(client.package_version_exists('progressbar', '2.2')) self.assertFalse(client.package_version_exists('PyYAML', '3.10')) with devpi.Client(binary_index) as client: self.assertFalse(client.package_version_exists('progressbar', '2.2')) self.assertTrue(client.package_version_exists('PyYAML', '3.10'))
def test_different_styles(self): user = "******" with devpi_server() as server_url, devpi_index(server_url, user, "wheels") as (destination_index, password): main(["tests/fixture/sample_different_styles.txt", destination_index, user, password]) with devpi.Client(destination_index) as devpi_client: self.assertTrue(devpi_client.package_version_exists("pygments", "1.6")) self.assertTrue(devpi_client.package_version_exists("Pygments", "1.6")) self.assertTrue(devpi_client.package_version_exists("Django", "1.6.5")) self.assertTrue(devpi_client.package_version_exists("django", "1.6.5"))
def test_reupload_is_safe(self): user = "******" with devpi_server() as server_url, devpi_index(server_url, user, "wheels") as (destination_index, password): main(["tests/fixture/sample_simple.txt", destination_index, user, password]) main(["tests/fixture/sample_multiple_versions.txt", destination_index, user, password]) with devpi.Client(destination_index) as devpi_client: self.assertTrue(devpi_client.package_version_exists("progressbar", "2.1")) self.assertTrue(devpi_client.package_version_exists("progressbar", "2.2")) self.assertTrue(devpi_client.package_version_exists("six", "1.7.3"))
def test_different_styles(self): user = '******' with devpi_server() as server_url, devpi_index(server_url, user, 'wheels') as (destination_index, password): main(['tests/fixture/sample_different_styles.txt', destination_index, user, password]) with devpi.Client(destination_index) as devpi_client: self.assertTrue(devpi_client.package_version_exists('pygments', '1.6')) self.assertTrue(devpi_client.package_version_exists('Pygments', '1.6')) self.assertTrue(devpi_client.package_version_exists('Django', '1.6.5')) self.assertTrue(devpi_client.package_version_exists('django', '1.6.5'))
def test_reupload_is_safe(self): user = '******' with devpi_server() as server_url, devpi_index(server_url, user, 'wheels') as (destination_index, password): main(['tests/fixture/sample_simple.txt', destination_index, user, password]) main(['tests/fixture/sample_multiple_versions.txt', destination_index, user, password]) with devpi.Client(destination_index) as devpi_client: self.assertTrue(devpi_client.package_version_exists('progressbar', '2.1')) self.assertTrue(devpi_client.package_version_exists('progressbar', '2.2')) self.assertTrue(devpi_client.package_version_exists('six', '1.7.3'))
def test_upload_package_version(self): user = '******' with devpi_server() as server_url, devpi_index( server_url, user, 'wheels') as (destination_index, password): with devpi.Client(server_url + '/test/wheels', user, password) as devpi_client: devpi_client.upload( 'tests/fixture/non-pure_package/dist/test_package-0.1_dev-cp27-none-linux_x86_64.whl' ) self.assertTrue( devpi_client.package_version_exists( 'test_package', '0.1-dev'))
def test_continue_on_failed(self): user = '******' with devpi_server() as server_url, devpi_index( server_url, user, 'wheels') as (destination_index, password): main([ 'tests/fixture/sample_continue_on_failed.txt', destination_index, user, password ]) with devpi.Client(destination_index) as devpi_client: self.assertTrue( devpi_client.package_version_exists('progressbar', '2.2'))
def test_with_blacklist(self): user = '******' with devpi_server() as server_url, devpi_index( server_url, user, 'wheels') as (destination_index, password): main([ 'tests/fixture/sample_simple.txt', destination_index, user, password, '--blacklist={}'.format('tests/fixture/sample_no_version.txt') ]) with devpi.Client(destination_index) as devpi_client: self.assertFalse( devpi_client.package_version_exists('progressbar', '2.2')) self.assertTrue( devpi_client.package_version_exists('six', '1.7.3'))
def test_with_blacklist(self): user = "******" with devpi_server() as server_url, devpi_index(server_url, user, "wheels") as (destination_index, password): main( [ "tests/fixture/sample_simple.txt", destination_index, user, password, "--blacklist={}".format("tests/fixture/sample_no_version.txt"), ] ) with devpi.Client(destination_index) as devpi_client: self.assertFalse(devpi_client.package_version_exists("progressbar", "2.2")) self.assertTrue(devpi_client.package_version_exists("six", "1.7.3"))
def test_different_styles(self): user = '******' with devpi_server() as server_url, devpi_index( server_url, user, 'wheels') as (destination_index, password): main([ 'tests/fixture/sample_different_styles.txt', destination_index, user, password ]) with devpi.Client(destination_index) as devpi_client: self.assertTrue( devpi_client.package_version_exists('pygments', '1.6')) self.assertTrue( devpi_client.package_version_exists('Pygments', '1.6')) self.assertTrue( devpi_client.package_version_exists('Django', '1.6.5')) self.assertTrue( devpi_client.package_version_exists('django', '1.6.5'))
def test_reupload_is_safe(self): user = '******' with devpi_server() as server_url, devpi_index( server_url, user, 'wheels') as (destination_index, password): main([ 'tests/fixture/sample_simple.txt', destination_index, user, password ]) main([ 'tests/fixture/sample_multiple_versions.txt', destination_index, user, password ]) with devpi.Client(destination_index) as devpi_client: self.assertTrue( devpi_client.package_version_exists('progressbar', '2.1')) self.assertTrue( devpi_client.package_version_exists('progressbar', '2.2')) self.assertTrue( devpi_client.package_version_exists('six', '1.7.3'))
def test_reports_junit_xml(self): user = '******' with devpi_server() as server_url, devpi_index(server_url, user, 'wheels') as (destination_index, password): with devpi.Client(destination_index, user, password) as client: client.upload('tests/fixture/pure_package/dist/test_package-0.1_dev-py2.py3-none-any.whl') tempdir = tempfile.mkdtemp() try: junit_filename = os.path.join(tempdir, 'junit.xml') main(['tests/fixture/sample_junit.txt', destination_index, user, password, '--junit-xml', junit_filename]) root = ET.parse(junit_filename) ET.dump(root) self._assert_test_case(root, 'failure', 'package-that-hopefully-not-exists 99.999') self._assert_test_case(root, 'skipped', 'test-package 0.1-dev') pb_elems = root.findall(".//testcase[@name='progressbar 2.2']") self.assertEqual(1, len(pb_elems)) pb_elem = pb_elems[0] self.assertIsNone(pb_elem.find('failure')) self.assertIsNone(pb_elem.find('error')) self.assertIsNone(pb_elem.find('skipped')) finally: shutil.rmtree(tempdir)
def test_upload_package_version(self): user = '******' with devpi_server() as server_url, devpi_index(server_url, user, 'wheels') as (destination_index, password): with devpi.Client(server_url + '/test/wheels', user, password) as devpi_client: devpi_client.upload('tests/fixture/non-pure_package/dist/test_package-0.1_dev-cp27-none-linux_x86_64.whl') self.assertTrue(devpi_client.package_version_exists('test_package', '0.1-dev'))
def test_upload_package_version(self): user = "******" with devpi_server() as server_url, devpi_index(server_url, user, "wheels") as (destination_index, password): with devpi.Client(server_url + "/test/wheels", user, password) as devpi_client: devpi_client.upload("tests/fixture/package/dist/test_package-0.1_dev-cp27-none-linux_x86_64.whl") self.assert_(devpi_client.package_version_exists("test_package", "0.1-dev"))