Skip to content

refactor: rename pretalx namespaces to eventyay for talks suite - submission#3356

Draft
ViRUS-0-0 wants to merge 1 commit intofossasia:devfrom
ViRUS-0-0:issue-2292-submissions
Draft

refactor: rename pretalx namespaces to eventyay for talks suite - submission#3356
ViRUS-0-0 wants to merge 1 commit intofossasia:devfrom
ViRUS-0-0:issue-2292-submissions

Conversation

@ViRUS-0-0
Copy link
Copy Markdown
Contributor

@ViRUS-0-0 ViRUS-0-0 commented Apr 23, 2026

Closes #2292 - Submission Tests

This PR fixes the legacy pretalx import in the submission tests to their equivalent equivalent model.

The changes outside the submission folder were necessary to fix global test setup errors, such as outdated database field names (like organizer vs organiser) and incorrect namespaces (eventyay vs pretalx), which were causing the submission tests to fail before they even started.

To run the tests

docker compose build  web
docker compose up -d
docker compose run exec pytest tests/talk/submission

The submission tests now run successfully

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

Results (153.21s (0:02:33)):
     190 passed

Note : With the change in the conftest.py file from pretalx to eventyay model, tests other than submission will stop working because they still have the legacy namespace.

Summary by Sourcery

Update talk submission tests and related configuration to use the current eventyay models and plugins instead of legacy pretalx namespaces, ensuring the submission test suite runs successfully.

Bug Fixes:

  • Align organiser/organizer field names and related team permission attributes in test fixtures with the current event model to prevent test setup failures.
  • Adjust reviewer permission handling to return False on invalid objects instead of raising an exception, avoiding errors in permission checks.
  • Update country question assertion to match the current country answer representation.

Enhancements:

  • Switch plugin tests and dummy app metadata from pretalx to eventyay plugin APIs and metadata classes.
  • Register the dummy plugin app automatically in test environments to support plugin-related tests.

Copilot AI review requested due to automatic review settings April 23, 2026 17:09
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 23, 2026

Reviewer's Guide

Refactors remaining pretalx-era namespaces and organiser/organizer fields in talk tests and submission-related code to match the current eventyay data model, adjusts reviewer permission handling, and wires in a dummy plugin app so the submission test suite runs cleanly under the new schema.

Class diagram for submission reviewer access context

classDiagram

  class User {
  }

  class Submission {
    +Event event
    +ReviewerSet assigned_reviewers
  }

  class Event {
    +ReviewPhase active_review_phase
  }

  class ReviewerSet {
    +bool contains(user User)
    +ReviewerSet all()
  }

  class ReviewPhase {
    +bool allows_reviewer(user User, submission Submission)
  }

  class PermissionsModule {
    +bool has_reviewer_access(user User, obj Object)
  }

  PermissionsModule --> Submission : uses
  PermissionsModule --> User : uses
  Submission --> Event : event
  Submission --> ReviewerSet : assigned_reviewers
  Event --> ReviewPhase : active_review_phase
  ReviewerSet --> User : contains
Loading

Flow diagram for updated has_reviewer_access permission check

flowchart TD
  A["has_reviewer_access(user, obj)"] --> B{obj has submission attribute}
  B -- Yes --> C["obj = obj.submission"]
  B -- No --> D["obj unchanged"]
  C --> E{obj is instance of Submission}
  D --> E

  E -- No --> F["return False"]
  E -- Yes --> G{user in obj.assigned_reviewers}

  G -- Yes --> H["return True"]
  G -- No --> I["phase = obj.event.active_review_phase"]
  I --> J{phase allows reviewer}
  J -- Yes --> H
  J -- No --> F
Loading

File-Level Changes

Change Details Files
Align organiser/organizer fields, team permissions, and related fixtures in talk tests with the current event model so submission tests can set up events and teams correctly.
  • Rename Team model field usages from organiser to organizer and can_change_organiser_settings to can_change_organizer_settings in fixtures.
  • Update Event fixture creation to use organizer instead of organiser when associating organisers with events.
  • Adjust user/permission fixtures (orga_user, review_user, etc.) to traverse event.organizer.teams and updated permission flags.
  • Switch User creation in fixtures from name to fullname where required by the current User model.
app/tests/talk/conftest.py
Migrate plugin-related tests and dummy plugin app from pretalx plugin API to eventyay plugin API and ensure the dummy app is loadable in tests.
  • Change imports in plugin tests from pretalx.common.plugins to eventyay.base.plugins and from tests.dummy_app to tests.talk.dummy_app.
  • Update plugin tests to assert against PluginApp.EventyayPluginMeta instead of PretalxPluginMeta.
  • Enhance PluginApp test AppConfig to set a concrete path and rename inner PretalxPluginMeta to EventyayPluginMeta while keeping existing metadata.
  • Include the dummy plugin app in INSTALLED_APPS when IS_TESTING so plugin discovery works in tests.
app/tests/talk/common/test_common_plugins.py
app/tests/talk/dummy_app.py
app/eventyay/config/settings.py
Point submission tests at the eventyay base models instead of legacy pretalx modules and realign expectations with current form behavior.
  • Update submission assignment test imports from pretalx.common.models.mixins and pretalx.submission.models.submission to eventyay.base.models.mixins and eventyay.base.models.submission.
  • Adjust country-question test expectations so cleaned data is the country code string rather than a Country object, matching current cleaning logic.
app/tests/talk/submission/test_submission_model.py
app/tests/talk/submission/test_question_model.py
Relax reviewer permission checks so they safely return False when called with unsupported objects instead of raising, preventing test setup failures and making permission checks more robust.
  • Change has_reviewer_access to return False when the resolved object is not a Submission rather than raising an exception.
app/eventyay/submission/permissions.py
Add and touch empty or unchanged submission-related test modules to ensure they are part of the suite and compatible with the new namespaces.
  • Ensure various submission-related test modules (access code, CFP, review, submission permissions, submission type) are wired into the test suite under the updated namespace layout.
  • Keep file contents functionally unchanged while allowing the suite to run under the eventyay model.
app/tests/talk/dummy_signals.py
app/tests/talk/submission/test_access_code_model.py
app/tests/talk/submission/test_cfp_model.py
app/tests/talk/submission/test_review_model.py
app/tests/talk/submission/test_submission_permissions.py
app/tests/talk/submission/test_submission_type_model.py

Assessment against linked issues

Issue Objective Addressed Explanation
#2292 Update the tests/talk suite to replace stale pretalx imports and namespaces with the corresponding eventyay equivalents wherever such equivalents exist, so that test collection no longer raises ModuleNotFoundError for pretalx.*. The PR updates a subset of pretalx references (notably in tests/talk/submission, tests/talk/common/test_common_plugins.py, dummy_app, and related settings/permissions), but the PR description explicitly states that tests other than the submission suite still use the legacy namespace and will stop working. Therefore, stale pretalx imports remain elsewhere in tests/talk, so the objective is not fully met for the entire talk suite.
#2292 Ensure that pytest can successfully collect and run the entire tests/talk test suite without import errors related to pretalx. The PR brings tests/talk/submission (and some common plugin tests) into a working state, and confirms that the submission tests now pass. However, the PR explicitly notes that other talk tests will stop working because they still have the legacy pretalx namespace. Thus, pytest cannot yet collect and run the full tests/talk suite successfully.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@ViRUS-0-0 ViRUS-0-0 marked this pull request as ready for review April 24, 2026 11:49
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Changing has_reviewer_access to return False instead of raising on non‑Submission objects alters its contract and can hide incorrect call sites; consider at least logging, asserting in debug, or keeping the exception in non-production contexts so misuse is still surfaced during development.
  • The test-only plugin registration in INSTALLED_APPS ('tests.talk.dummy_app.PluginApp') hardcodes a deep path into the main settings; consider using a dedicated test settings override or a shorter app label to decouple core settings from the tests’ package structure.
  • In test_submission_assign_code, the alias name pretalx_submission for eventyay.base.models.submission is now misleading; renaming the alias to match the new namespace will make the intent of the test clearer.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Changing `has_reviewer_access` to return `False` instead of raising on non‑`Submission` objects alters its contract and can hide incorrect call sites; consider at least logging, asserting in debug, or keeping the exception in non-production contexts so misuse is still surfaced during development.
- The test-only plugin registration in `INSTALLED_APPS` (`'tests.talk.dummy_app.PluginApp'`) hardcodes a deep path into the main settings; consider using a dedicated test settings override or a shorter app label to decouple core settings from the tests’ package structure.
- In `test_submission_assign_code`, the alias name `pretalx_submission` for `eventyay.base.models.submission` is now misleading; renaming the alias to match the new namespace will make the intent of the test clearer.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ViRUS-0-0 ViRUS-0-0 marked this pull request as draft April 27, 2026 20:58
@ViRUS-0-0 ViRUS-0-0 added the On Hold Putting this on hold to focus on other higher priority. Don't take this issue label May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

On Hold Putting this on hold to focus on other higher priority. Don't take this issue

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Talk test suite fails due to unresolved pretalx imports

2 participants