This PR is to fix flaky tests tests/test_model.py::TestMagicMethods::test_not_multiple_instance, tests/test_model.py::TestMagicMethods::test_validate_multiplicity after running tests/test_model.py::TestAutoIdentifiers::test_bad_autoid, but pass when they are run in isolation.
Test tests/test_model.py::TestMagicMethods::test_not_multiple_instance and tests/test_model.py::TestMagicMethods::test_validate_multiplicity should pass after running tests/test_model.py::TestAutoIdentifiers::test_bad_autoid.
Actual result
tests/test_model.py::TestMagicMethods::test_not_multiple_instance and tests/test_model.py::TestMagicMethods::test_validate_multiplicity fail:
else:
> raise ConfigurationError("Unknown auto-id type")
E cromulent.model.ConfigurationError: Unknown auto-id type
cromulent/model.py:281: ConfigurationError
Why they fail
model.factory.auto_id_type is polluted after tests/test_model.py::TestAutoIdentifiers::test_bad_autoid
Fix
Reset model.factory.auto_id_type to int-per-segment at the end of tests/test_model.py::TestAutoIdentifiers::test_bad_autoid to avoid flaky tests.
What is the purpose of the change
This PR is to fix flaky tests
tests/test_model.py::TestMagicMethods::test_not_multiple_instance
,tests/test_model.py::TestMagicMethods::test_validate_multiplicity
after runningtests/test_model.py::TestAutoIdentifiers::test_bad_autoid
, but pass when they are run in isolation.Reproduce the test failure
Run the following command:
Expexted result
Test
tests/test_model.py::TestMagicMethods::test_not_multiple_instance
andtests/test_model.py::TestMagicMethods::test_validate_multiplicity
should pass after runningtests/test_model.py::TestAutoIdentifiers::test_bad_autoid
.Actual result
tests/test_model.py::TestMagicMethods::test_not_multiple_instance
andtests/test_model.py::TestMagicMethods::test_validate_multiplicity
fail:Why they fail
model.factory.auto_id_type
is polluted aftertests/test_model.py::TestAutoIdentifiers::test_bad_autoid
Fix
Reset
model.factory.auto_id_type
toint-per-segment
at the end oftests/test_model.py::TestAutoIdentifiers::test_bad_autoid
to avoid flaky tests.