Review: Needs Fixing


Diff comments:

> diff --git a/src/maastesting/pytest/django.py 
> b/src/maastesting/pytest/django.py
> index 5eb7915..83e18fc 100644
> --- a/src/maastesting/pytest/django.py
> +++ b/src/maastesting/pytest/django.py
> @@ -100,12 +100,12 @@ def pytest_load_initial_conftests(early_config, parser, 
> args):
>      early_config.stash[cluster_stash] = cluster
>      os.environ[
>          "DJANGO_SETTINGS_MODULE"
> -    ] = "maasserver.djangosettings.development"
> +    ] = "maasserver.djangosettings.perftest"

this will use `perftest` for all of the pytest fixtures, which is not what we 
want.

How about we let the caller set DJANGO_SETTINGS_MODULE, and only if it's not 
there set it to `m.ds.development` and then instead of importing `development` 
or `perftest` directly, use `import django.conf; 
django.conf.settings.DATABASES[...]`

then in the runner for e.g. run-perf-tests-ci set DJANGO_SETTINGS_MODULE to 
`m.ds.perftest`

>      import django
>  
> -    from maasserver.djangosettings import development
> +    from maasserver.djangosettings import perftest
>  
> -    database = development.DATABASES["default"]
> +    database = perftest.DATABASES["default"]
>      template = f"{database['NAME']}_test"
>      early_config.stash[db_template_stash] = template
>      database["NAME"] = "no_such_db"


-- 
https://code.launchpad.net/~alexsander-souza/maas/+git/maas/+merge/443444
Your team MAAS Committers is subscribed to branch maas:master.


-- 
Mailing list: https://launchpad.net/~sts-sponsors
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sts-sponsors
More help   : https://help.launchpad.net/ListHelp

Reply via email to