SUSE / suse-migration-services

GNU General Public License v3.0
7 stars 11 forks source link

tox fails on maste with setup() takes 2 positional arguments but 3 were given #235

Closed KeithMnemonic closed 2 years ago

KeithMnemonic commented 2 years ago

Merging changes are currently blocked as tox on master fails with

===================================================================================== short test summary info =====================================================================================
ERROR fstab_test.py::TestFstab::test_read_with_skipped_entries - TypeError: setup() takes 2 positional arguments but 3 were given
ERROR fstab_test.py::TestFstab::test_get_devices - TypeError: setup() takes 2 positional arguments but 3 were given
ERROR fstab_test.py::TestFstab::test_add_entry - TypeError: setup() takes 2 positional arguments but 3 were given
ERROR fstab_test.py::TestFstab::test_export - TypeError: setup() takes 2 positional arguments but 3 were given
ERROR migration_config_test.py::TestMigrationConfig::test_get_migration_product_auto_detected - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_get_migration_product_targets - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_update_migration_config_file_no_autodetect - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_is_zypper_migration_plugin_requested - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_is_debug_requested - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_write_config_file - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_update_migration_config_file_empty - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_update_migration_config_file_just_comments - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_update_migration_config_file_slightly_broken - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_update_migration_config_file_very_broken - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_update_migration_config_file_violates_schema - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR migration_config_test.py::TestMigrationConfig::test_get_migration_config_file_content - TypeError: setup() takes 3 positional arguments but 4 were given
ERROR suse_product_test.py::TestSUSEProduct::test_baseproduct_raises - TypeError: setup() takes 2 positional arguments but 3 were given
ERROR suse_product_test.py::TestSUSEProduct::test_delete_target_registration_raises - TypeError: setup() takes 2 positional arguments but 3 were given
ERROR suse_product_test.py::TestSUSEProduct::test_baseproduct_tag_text - TypeError: setup() takes 2 positional arguments but 3 were given
ERROR suse_product_test.py::TestSUSEProduct::test_baseproduct_tag_text_raises - TypeError: setup() takes 2 positional arguments but 3 were given
KeithMnemonic commented 2 years ago

It looks like this is due to https://docs.pytest.org/en/stable/changelog.html. I tested pinning pytest==6.2.5 and then the test pass. @jesusbv inidicated he would rather fix the issue instead of pining. If you do something like this it seems to work

    def setup(self):
        with patch('os.path.exists') as mock_os_path_exists:
           mock_os_path_exists.return_value = True
            self.fstab = Fstab()
            self.fstab.read('../data/fstab')

I could not see exactly in the change log why is causing this to fail now.