Skip to content
This repository was archived by the owner on May 17, 2022. It is now read-only.
This repository was archived by the owner on May 17, 2022. It is now read-only.

Registering a UUID generator in the plugin init is making testing kind of hairy #130

@MattDietz

Description

@MattDietz

Specifically, the block:

    # NOTE(jkoelker) Register the event on all models that have ids
    for _name, klass in inspect.getmembers(models, inspect.isclass):
        if klass is models.HasId:
            continue

        if models.HasId in klass.mro():
            event.listen(klass, "init", _perhaps_generate_id)

This causes issues because of a subtle interdependency. Reorganizing the plugin into separate submodules revealed this because the test ordering changed, causing the plugin to not be the first one to configure the database, which in turn means the event listener on all models with HasId set weren't generating UUIDs in some cases. From the looks of things, someone previously noticed this and set an assertIsNone on the entity UUID on some of the IPAM test cases instead of trying to figure out why it would assign an ID in some cases and not others 👎

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions