diff --git a/.github/scripts/version_check.py b/.github/scripts/version_check.py index 94a59f0f93..68e2ff1e25 100644 --- a/.github/scripts/version_check.py +++ b/.github/scripts/version_check.py @@ -92,7 +92,9 @@ def check_version_number(version_string, allow_duplicate=False): if __name__ == '__main__': if 'only_version' in sys.argv: here = Path(__file__).parent.absolute() - version_file = here.joinpath('..', 'InvenTree', 'InvenTree', 'api_version.py') + version_file = here.joinpath( + '..', '..', 'src', 'backend', 'InvenTree', 'InvenTree', 'api_version.py' + ) text = version_file.read_text() results = re.findall(r"""INVENTREE_API_VERSION = (.*)""", text) print(results[0]) diff --git a/.github/workflows/qc_checks.yaml b/.github/workflows/qc_checks.yaml index d60314b077..7bcc95d8ce 100644 --- a/.github/workflows/qc_checks.yaml +++ b/.github/workflows/qc_checks.yaml @@ -157,7 +157,7 @@ jobs: if: needs.paths-filter.outputs.api == 'false' run: | pip install requests==2.31.0 >/dev/null 2>&1 - version="$(python3 ci/version_check.py only_version 2>&1)" + version="$(python3 .github/scripts/version_check.py only_version 2>&1)" echo "Version: $version" url="https://raw.githubusercontent.com/inventree/schema/main/export/${version}/api.yaml" echo "URL: $url" @@ -176,7 +176,7 @@ jobs: if: github.ref == 'refs/heads/master' && needs.paths-filter.outputs.api == 'true' run: | pip install requests==2.31.0 >/dev/null 2>&1 - version="$(python3 ci/version_check.py only_version 2>&1)" + version="$(python3 .github/scripts/version_check.py only_version 2>&1)" echo "Version: $version" echo "version=$version" >> "$GITHUB_OUTPUT" diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index d12cb6a189..c02a03896a 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -246,7 +246,7 @@ plugins: handlers: python: paths: - - ../InvenTree + - ../src/backend/InvenTree options: show_symbol_type_heading: true show_symbol_type_toc: true diff --git a/src/backend/InvenTree/InvenTree/tests.py b/src/backend/InvenTree/InvenTree/tests.py index ff60d83881..a8a702b23f 100644 --- a/src/backend/InvenTree/InvenTree/tests.py +++ b/src/backend/InvenTree/InvenTree/tests.py @@ -670,40 +670,7 @@ class TestHelpers(TestCase): with self.assertRaises(django_exceptions.ValidationError): InvenTree.helpers_model.download_image_from_url(url) - def dl_helper(url, expected_error, timeout=2.5, retries=3): - """Helper function for unit testing downloads. - - As the httpstat.us service occasionally refuses a connection, - we will simply try multiple times - """ - tries = 0 - - with self.assertRaises(expected_error): - while tries < retries: - try: - InvenTree.helpers_model.download_image_from_url( - url, timeout=timeout - ) - break - except Exception as exc: - if type(exc) is expected_error: - # Re-throw this error - raise exc - else: - print('Unexpected error:', type(exc), exc) - - tries += 1 - time.sleep(10 * tries) - - # Attempt to download an image which throws a 404 - # TODO: Re-implement this test when we are happier with the external service - # dl_helper("https://httpstat.us/404", requests.exceptions.HTTPError, timeout=10) - - # Attempt to download, but timeout - # TODO: Re-implement this test when we are happier with the external service - # dl_helper("https://httpstat.us/200?sleep=5000", requests.exceptions.ReadTimeout, timeout=1) - - large_img = 'https://github.com/inventree/InvenTree/raw/master/InvenTree/InvenTree/static/img/paper_splash_large.jpg' + large_img = 'https://github.com/inventree/InvenTree/raw/master/src/backend/InvenTree/InvenTree/static/img/paper_splash_large.jpg' InvenTreeSetting.set_setting( 'INVENTREE_DOWNLOAD_IMAGE_MAX_SIZE', 1, change_user=None