mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-20 11:13:28 +00:00
feat(backend): add performance tests (#11017)
* feat(backend): add performance test ref #11002 * feat(backend): add performance test (#486) * chore(deps): bump the dependencies group across 1 directory with 2 updates (#11003) * chore(deps): bump the dependencies group across 1 directory with 2 updates Bumps the dependencies group with 2 updates in the /src/backend directory: [django-q2](https://github.com/GDay/django-q2) and [sentry-sdk](https://github.com/getsentry/sentry-python). Updates `django-q2` from 1.8.0 to 1.9.0 - [Release notes](https://github.com/GDay/django-q2/releases) - [Changelog](https://github.com/django-q2/django-q2/blob/master/CHANGELOG.md) - [Commits](https://github.com/GDay/django-q2/compare/v1.8.0...v1.9.0) Updates `sentry-sdk` from 2.46.0 to 2.47.0 - [Release notes](https://github.com/getsentry/sentry-python/releases) - [Changelog](https://github.com/getsentry/sentry-python/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-python/compare/2.46.0...2.47.0) --- updated-dependencies: - dependency-name: django-q2 dependency-version: 1.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: sentry-sdk dependency-version: 2.47.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] <support@github.com> * fix style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Matthias Mair <code@mjmair.com> * Rearrange python package installs in are metal setup (#11005) * Reorder pip installation steps in bare metal setup * Reorder pip installation steps in bare metal setup * remove unused lines * Fix docs formatting (#11008) * Remove prefetch_related from parametric data filter (#11007) - Not required as we do not process the parameter fields in python * [refactor] Generic status API (#11009) * Fix docs formatting * [refactor] cache custom states - Generic state API endpoint executed query for each state type - We can run a single database query and cache these in memory - Reduces query time by ~50% * [refactor] Build list (#11010) - Prefetch project_code - Annotate parameter data * Improve the documentation installation instructions. (#11011) Co-authored-by: Mitch Davis <mjd@afork.com> * [refactor] Improve primary_address annotation for Company API (#11006) * Refactor primary_address annotation - Remove SerializerMethodField - Better cache introspection * Allow address detail to be optional * Refactor address caching * Fix primary_address annotation * Remove "address_count" field - Pointless annotation which is not used anywhere * Update API version * Tweak docs page * Tweak unit tests * feat(backend): add performance test ref #11002 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Michael <michael@buchmann.ruhr> Co-authored-by: Oliver <oliver.henry.walters@gmail.com> Co-authored-by: Mitch Davis <mjd+github@afork.com> Co-authored-by: Mitch Davis <mjd@afork.com> * add oidc perm * fix run setup * add gitignore * pin action * enable DB for test * patch test detection * move test argument into tasks * seperate performance testing into own step * add automigration * update test * Increase MAX_QUERY_TIME to 60 seconds * use newer python for better prerformance / measurement options * skip plugin install step * add debug step * add debug stmt * make version import safe * fix command * more debugging * move import * rollback changes * do full install * rollback skip_plugins too * hide version * new debug try * add more debug * try 3.13 * try reinstalling the cffi * reinstall cffi? * reset debug * rollback debug steos * add initial tests --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Michael <michael@buchmann.ruhr> Co-authored-by: Oliver <oliver.henry.walters@gmail.com> Co-authored-by: Mitch Davis <mjd+github@afork.com> Co-authored-by: Mitch Davis <mjd@afork.com>
This commit is contained in:
27
tasks.py
27
tasks.py
@@ -1284,6 +1284,7 @@ def test_translations(c):
|
||||
'coverage': 'Run code coverage analysis (requires coverage package)',
|
||||
'translations': 'Compile translations before running tests',
|
||||
'keepdb': 'Keep the test database after running tests (default = False)',
|
||||
'pytest': 'Use pytest to run tests',
|
||||
}
|
||||
)
|
||||
def test(
|
||||
@@ -1296,6 +1297,7 @@ def test(
|
||||
coverage=False,
|
||||
translations=False,
|
||||
keepdb=False,
|
||||
pytest=False,
|
||||
):
|
||||
"""Run unit-tests for InvenTree codebase.
|
||||
|
||||
@@ -1341,10 +1343,16 @@ def test(
|
||||
else:
|
||||
cmd += ' --exclude-tag migration_test'
|
||||
|
||||
cmd += ' --exclude-tag performance_test'
|
||||
|
||||
if coverage:
|
||||
# Run tests within coverage environment, and generate report
|
||||
run(c, f'coverage run {manage_py_path()} {cmd}')
|
||||
run(c, 'coverage xml -i')
|
||||
elif pytest:
|
||||
# Use pytest to run the tests
|
||||
migrate(c)
|
||||
run(c, f'pytest {manage_py_path().parent.parent} --codspeed')
|
||||
else:
|
||||
# Run simple test runner, without coverage
|
||||
manage(c, cmd, pty=pty)
|
||||
@@ -1529,6 +1537,13 @@ def version(c):
|
||||
get_static_dir,
|
||||
)
|
||||
|
||||
def get_value(fnc):
|
||||
"""Helper function to safely get value from function, catching import exceptions."""
|
||||
try:
|
||||
return fnc()
|
||||
except (ModuleNotFoundError, ImportError):
|
||||
return wrap_color('ENVIRONMENT ERROR', '91')
|
||||
|
||||
# Gather frontend version information
|
||||
_, node, yarn = node_available(versions=True)
|
||||
|
||||
@@ -1561,17 +1576,17 @@ Invoke Tool {invoke_path}
|
||||
|
||||
Installation paths:
|
||||
Base {local_dir()}
|
||||
Config {get_config_file()}
|
||||
Plugin File {get_plugin_file() or NOT_SPECIFIED}
|
||||
Media {get_media_dir(error=False) or NOT_SPECIFIED}
|
||||
Static {get_static_dir(error=False) or NOT_SPECIFIED}
|
||||
Backup {get_backup_dir(error=False) or NOT_SPECIFIED}
|
||||
Config {get_value(get_config_file)}
|
||||
Plugin File {get_value(get_plugin_file) or NOT_SPECIFIED}
|
||||
Media {get_value(lambda: get_media_dir(error=False)) or NOT_SPECIFIED}
|
||||
Static {get_value(lambda: get_static_dir(error=False)) or NOT_SPECIFIED}
|
||||
Backup {get_value(lambda: get_backup_dir(error=False)) or NOT_SPECIFIED}
|
||||
|
||||
Versions:
|
||||
InvenTree {InvenTreeVersion.inventreeVersion()}
|
||||
API {InvenTreeVersion.inventreeApiVersion()}
|
||||
Python {python_version()}
|
||||
Django {InvenTreeVersion.inventreeDjangoVersion()}
|
||||
Django {get_value(InvenTreeVersion.inventreeDjangoVersion)}
|
||||
Node {node if node else NA}
|
||||
Yarn {yarn if yarn else NA}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user