Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.lister.debian.tests.test_lister::test_lister_debian
Failed

TEST RESULT

Run At
Jan 25 2021, 2:32 PM
Details
lister_debian = <swh.lister.debian.lister.DebianLister object at 0x7faca3852e80> datadir = '/var/lib/jenkins/workspace/DLS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/lister/debian/tests/data' requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7faca3b3c2b0> def test_lister_debian(lister_debian, datadir, requests_mock_datadir): """Simple debian listing should create scheduled tasks """ # Run the lister > lister_debian.run() .tox/py3/lib/python3.7/site-packages/swh/lister/debian/tests/test_lister.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .tox/py3/lib/python3.7/site-packages/swh/lister/debian/lister.py:250: in run _, new_area_packages = self.ingest_data(None) .tox/py3/lib/python3.7/site-packages/swh/lister/core/lister_base.py:489: in ingest_data injected = self.inject_repo_data_into_db(models_list) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <swh.lister.debian.lister.DebianLister object at 0x7faca3852e80> models_list = <generator object DebianLister.transport_response_simplified at 0x7faca3b329a8> def inject_repo_data_into_db(self, models_list): """Generate the Package entries that didn't previously exist. Contrary to ListerBase, we don't actually insert the data in database. `schedule_missing_tasks` does it once we have the origin and task identifiers. """ by_name_version = {} temp_packages = [] area_id = self.area.id for model in models_list: name = model["name"] version = model["version"] temp_packages.append( {"area_id": area_id, "name": name, "version": version,} ) by_name_version[name, version] = model # Add all the listed packages to a temporary table self.db_session.execute(CreateTable(TempPackage.__table__)) self.db_session.bulk_insert_mappings(TempPackage, temp_packages) def exists_tmp_pkg(db_session, model): return ( db_session.query(model) .filter(Package.area_id == TempPackage.area_id) .filter(Package.name == TempPackage.name) .filter(Package.version == TempPackage.version) .exists() ) # Filter out the packages that already exist in the main Package table new_packages = ( self.db_session.query(TempPackage) .options(load_only("name", "version")) .filter(~exists_tmp_pkg(self.db_session, Package)) .all() ) self.old_area_packages = ( self.db_session.query(Package) .filter(exists_tmp_pkg(self.db_session, TempPackage)) .all() ) self.db_session.execute(DropTable(TempPackage.__table__)) added_packages = [] for package in new_packages: > model = by_name_version[package.name, package.version] E KeyError: ('0ad', '0.0.21-2') .tox/py3/lib/python3.7/site-packages/swh/lister/debian/lister.py:194: KeyError