Fix: Broken subfolder tests in postgres/docker CI in master (#3559)

* disable failing tests for sanity check

* run postgrest too

* only run problematic tests

* make paths relative

* refactor to reduce duplicate code

* remove testing restrictions again
This commit is contained in:
Matthias Mair 2022-08-17 01:10:56 +02:00 committed by GitHub
parent b9f83eefc8
commit 0a57f9d459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -185,9 +185,7 @@ jobs:
postgres:
name: Tests - DB [PostgreSQL]
runs-on: ubuntu-20.04
needs: [ 'javascript', 'html', 'pre-commit' ]
if: github.event_name == 'push'
env:
INVENTREE_DB_ENGINE: django.db.backends.postgresql

View File

@ -191,6 +191,10 @@ class InvenTreePluginTests(TestCase):
class RegistryTests(TestCase):
"""Tests for registry loading methods."""
def mockDir(self) -> None:
"""Returns path to mock dir"""
return str(Path(__file__).parent.joinpath('mock').absolute())
def run_package_test(self, directory):
"""General runner for testing package based installs."""
@ -223,7 +227,7 @@ class RegistryTests(TestCase):
def test_subfolder_loading(self):
"""Test that plugins in subfolders get loaded."""
self.run_package_test('InvenTree/plugin/mock')
self.run_package_test(self.mockDir())
def test_folder_loading(self):
"""Test that plugins in folders outside of BASE_DIR get loaded."""
@ -232,7 +236,7 @@ class RegistryTests(TestCase):
with tempfile.TemporaryDirectory() as tmp:
# Fill directory with sample data
new_dir = Path(tmp).joinpath('mock')
shutil.copytree(Path('InvenTree/plugin/mock').absolute(), new_dir)
shutil.copytree(self.mockDir(), new_dir)
# Run tests
self.run_package_test(str(new_dir))