@@ -50,10 +50,10 @@ def setUpClass(cls):
5050 cls .cfg = config .get_config ()
5151 cls .client = gen_python_client ()
5252 configuration = Configuration ()
53- configuration .username = ' admin'
54- configuration .password = ' password'
55- configuration .host = ' http://{}:24817' .format (socket .gethostname ())
56- configuration .safe_chars_for_path_param = '/'
53+ configuration .username = " admin"
54+ configuration .password = " password"
55+ configuration .host = " http://{}:24817" .format (socket .gethostname ())
56+ configuration .safe_chars_for_path_param = "/"
5757 cls .core_client = CoreApiClient (configuration )
5858
5959 def test_on_demand_pypi_full_sync (self ):
@@ -83,7 +83,9 @@ def test_on_demand_pypi_full_sync(self):
8383 self .assertIsNotNone (repo .latest_version_href )
8484 # As of August 11 2020, all_packages() returns 253,587 packages,
8585 # only 248,677 of them were downloadable
86- self .assertTrue (get_content_summary (repo .to_dict ())[PYTHON_CONTENT_NAME ] > 245000 )
86+ self .assertTrue (
87+ get_content_summary (repo .to_dict ())[PYTHON_CONTENT_NAME ] > 245000
88+ )
8789
8890
8991class PullThroughMirror (TestCaseUsingBindings , TestHelpersMixin ):
@@ -108,21 +110,26 @@ def test_pull_through_install(self):
108110 remote = self ._create_remote (url = PYPI_URL )
109111 distro = self ._create_distribution (remote = remote .pulp_href )
110112
111- if self .cli_client .run (("pip" , "list" )).stdout .find ("numpy" ) == - 1 :
112- content = self .content_api .list (name = "numpy" )
113- self .assertEqual (content .count , 0 , msg = "numpy content already present in test" )
113+ PACKAGE = "sampleproject"
114+ if self .cli_client .run (("pip" , "list" )).stdout .find (PACKAGE ) == - 1 :
115+ content = self .content_api .list (name = PACKAGE )
116+ self .assertEqual (
117+ content .count , 0 , msg = f"{ PACKAGE } content already present in test"
118+ )
114119 host = urlsplit (PULP_CONTENT_BASE_URL ).hostname
115120 url = urljoin (self .PYPI_HOST , f"{ distro .base_path } /simple/" )
116121 out = self .cli_client .run (
117- ("pip" , "install" , "--trusted-host" , host , "-i" , url , "numpy" )
122+ ("pip" , "install" , "--trusted-host" , host , "-i" , url , PACKAGE )
118123 )
119124 self .addCleanup (delete_orphans )
120- self .assertTrue (self .cli_client .run (("pip" , "list" )).stdout .find ("numpy" ) != - 1 , out )
121- self .addCleanup (self .cli_client .run , ("pip" , "uninstall" , "numpy" , "-y" ))
122- content = self .content_api .list (name = "numpy" )
125+ self .assertTrue (
126+ self .cli_client .run (("pip" , "list" )).stdout .find (PACKAGE ) != - 1 , out
127+ )
128+ self .addCleanup (self .cli_client .run , ("pip" , "uninstall" , PACKAGE , "-y" ))
129+ content = self .content_api .list (name = PACKAGE )
123130 self .assertEqual (content .count , 1 )
124131 else :
125- self .skipTest ("Uninstall numpy before running this test" )
132+ self .skipTest (f "Uninstall { PACKAGE } before running this test" )
126133
127134 def test_pull_through_simple (self ):
128135 """Tests that the simple page is properly modified when requesting a pull-through."""
@@ -139,14 +146,18 @@ def test_pull_through_simple(self):
139146 relative_path = f"{ distro .base_path } /{ package .filename } ?redirect="
140147 self .assertIn (urljoin (PULP_CONTENT_BASE_URL , relative_path ), package .url )
141148 digests = package .get_digests ()
142- self .assertEqual (PYTHON_XS_FIXTURE_CHECKSUMS [package .filename ], digests ["sha256" ])
149+ self .assertEqual (
150+ PYTHON_XS_FIXTURE_CHECKSUMS [package .filename ], digests ["sha256" ]
151+ )
143152
144153 def test_pull_through_with_repo (self ):
145154 """Tests that if content is already in repository, pull-through isn't used."""
146155 remote = self ._create_remote ()
147156 repo = self ._create_repo_and_sync_with_remote (remote )
148157 self .addCleanup (delete_orphans )
149- distro = self ._create_distribution (remote = remote .pulp_href , repository = repo .pulp_href )
158+ distro = self ._create_distribution (
159+ remote = remote .pulp_href , repository = repo .pulp_href
160+ )
150161
151162 url = urljoin (self .PYPI_HOST , f"{ distro .base_path } /simple/shelf-reader/" )
152163 response = requests .get (url )
0 commit comments