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

Add check for KeyError on reading plugin commit #6300

Merged
merged 3 commits into from Jan 21, 2024

Conversation

LavissaWoW
Copy link
Contributor

Closes #6286

Copy link

netlify bot commented Jan 20, 2024

Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit 93626d3
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/65ad239d71fddc0008e59951

@LavissaWoW
Copy link
Contributor Author

@SchrodingersGat Only fails in Postgres CI, and passes fine locally. Ideas?

======================================================================
ERROR: test_invalid_barcode (plugin.base.barcodes.test_barcode.SOAllocateTest)
Test when an invalid barcode is provided (does not match stock item).
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/InvenTree/InvenTree/InvenTree/plugin/base/barcodes/test_barcode.py", line 312, in test_invalid_barcode
    item.part.assign_barcode(barcode_data='abcde')
  File "/home/runner/work/InvenTree/InvenTree/InvenTree/InvenTree/models.py", line 1051, in assign_barcode
    self.save()
  File "/home/runner/work/InvenTree/InvenTree/InvenTree/part/models.py", line 474, in save
    self.full_clean()
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/django/db/models/base.py", line 1251, in full_clean
    raise ValidationError(errors)
django.core.exceptions.ValidationError: {'variant_of': ['Part instance with id 10003 does not exist.']}

----------------------------------------------------------------------

@SchrodingersGat
Copy link
Member

This looks like an error with the test fixtures. Sometimes if you change the order of operations of tests, the fixture data is "corrupt" - especially for postgres which is a lot stricter. No idea why your change would cause an error here.

In the part.yaml fixture, try adding is_template=true to part with pk=10003:

@SchrodingersGat SchrodingersGat merged commit 917a88c into inventree:master Jan 21, 2024
24 checks passed
@LavissaWoW LavissaWoW deleted the repo-fix branch January 21, 2024 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugin with git, but no commits causes all plugins to fail to load
2 participants