Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit tests: factory-boy>=3.0 breaking change #155

Closed
dmsimard opened this issue Aug 13, 2020 · 3 comments
Closed

unit tests: factory-boy>=3.0 breaking change #155

dmsimard opened this issue Aug 13, 2020 · 3 comments
Labels
bug tests Related to unit, functional or integration tests
Milestone

Comments

@dmsimard
Copy link
Contributor

What component is this about ?

unit tests (i.e, tox -e py3)

What is happening ?

factory-boy just released a new version and it looks like we might need to adjust unit tests due to breaking changes.

Screenshot from 2020-08-13 10-36-48

======================================================================
ERROR: api.tests.tests_file (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: api.tests.tests_file
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib64/python3.8/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/home/dmsimard/dev/git/ansible-community/ara/ara/api/tests/tests_file.py", line 23, in <module>
    from ara.api.tests import factories, utils
  File "/home/dmsimard/dev/git/ansible-community/ara/ara/api/tests/factories.py", line 36, in <module>
    class PlaybookFactory(factory.DjangoModelFactory):
AttributeError: module 'factory' has no attribute 'DjangoModelFactory'

What should be happening ?

Unit tests should not be failing :)

@dmsimard dmsimard added bug tests Related to unit, functional or integration tests labels Aug 13, 2020
@dmsimard
Copy link
Contributor Author

Pinned for now: https://review.opendev.org/#/c/746145/

arecordsansible pushed a commit that referenced this issue Aug 13, 2020
factory-boy just released a new 3.0 (and 3.0.1) version and it breaks
unit tests:
    AttributeError: module 'factory' has no attribute 'DjangoModelFactory'

Pin to <3.0 which is currently 2.12.0 while we figure it out.

Related: #155
Change-Id: Id987e126a05cf084e6c9ed18884dad11c81d1203
@dmsimard
Copy link
Contributor Author

Hitting this when building the rpm package with an up-to-date factory-boy in Fedora -- might need a fix for this in 1.5...

@dmsimard
Copy link
Contributor Author

Ok so it turns out the fix was simple after all -- the import just changed location as per the release notes: https://github.com/FactoryBoy/factory_boy/blob/master/docs/changelog.rst#300-2020-08-12

I've submitted a fix: https://review.opendev.org/#/c/752260/

@dmsimard dmsimard added this to the 1.5 milestone Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug tests Related to unit, functional or integration tests
Projects
None yet
Development

No branches or pull requests

1 participant