Closed uhurusurfa closed 4 years ago
I will take a look into this, fix and create a new release! Thanks for reporting!
There is an error in the test/ddf, maybe an IntegrityError
. The first step is having a better error message to understand what is going on, so you can try to use the new TransactionTestCase
class.
from django.test import TransactionTestCase as TestCase
Please, re-open the issue after you get more details.
Also, please try the version 3.0.3.
Works in 3.0.3 🚀 - thanks
My project has been using DDF for almost a year now and has worked great. Just tried ugrading to 3.* version and this error shown below is thrown. It seems to happen with most invocations of the G() constructor running Django 2.2.8 and Python 3.7.5 (works fine with DDF 2.0.0). Has anyone got any ideas?
` create_permission = G(ServicePermission, service=self.service, action="create") vi +6 # get
vi +142 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django_dynamic_fixture/init.py # _get return d.get(model, lesson=lesson, *kwargs) vi +605 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django_dynamic_fixture/ddf.py # get six.reraise(BadDataError, BadDataError(get_unique_model_name(model_class), e), sys.exc_info()[2]) vi +695 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/six.py # reraise raise value.with_traceback(tb) vi +596 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django_dynamic_fixture/ddf.py # get self._save_the_instance(instance) vi +573 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django_dynamic_fixture/ddf.py # _save_the_instance instance.save() vi +49 nexus/models/base.py # save super().save(args, **kwargs) vi +741 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/models/base.py # save force_update=force_update, update_fields=update_fields) vi +779 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/models/base.py # save_base force_update, using, update_fields, vi +851 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/models/base.py # _save_table forced_update) vi +900 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/models/base.py # _do_update return filtered._update(values) > 0 vi +760 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/models/query.py # _update return query.get_compiler(self.db).execute_sql(CURSOR) vi +1462 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/models/sql/compiler.py # execute_sql cursor = super().execute_sql(result_type) vi +1133 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/models/sql/compiler.py # execute_sql cursor.execute(sql, params) vi +67 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/backends/utils.py # execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) vi +76 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/backends/utils.py # _execute_with_wrappers return executor(sql, params, many, context) vi +79 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/backends/utils.py # _execute self.db.validate_no_broken_transaction() vi +438 /root/.local/share/virtualenvs/code-_Py8Si6I/lib/python3.7/site-packages/django/db/backends/base/base.py # validate_no_broken_transaction "An error occurred in the current transaction. You can't " django_dynamic_fixture.ddf.BadDataError: ('nexus.models.security.ServicePermission', TransactionManagementError("An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block."))`