• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-config-service / 7696705566

29 Jan 2024 01:17PM CUT coverage: 99.889%. Remained the same
7696705566

Pull #1033

github

web-flow
Bump types-requests from 2.31.0.20240106 to 2.31.0.20240125

Bumps [types-requests](https://github.com/python/typeshed) from 2.31.0.20240106 to 2.31.0.20240125.
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-requests
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #1033: Bump types-requests from 2.31.0.20240106 to 2.31.0.20240125

4494 of 4499 relevant lines covered (99.89%)

1.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.55
/src/chains/migrations/tests/utils.py
1
from django.apps import apps
1✔
2
from django.db import connection
1✔
3
from django.db.migrations.executor import MigrationExecutor
1✔
4
from django.db.migrations.state import StateApps
1✔
5
from django.test import TestCase
1✔
6

7

8
# Use this TestCase class in order to test migrations
9
# migrate_from – the name of the migration where the test starts
10
# migrate_to – the target migration
11
#
12
# Example:
13
# You can set models on a specific migration inside your implementation of setUpBeforeMigration()
14
# The validation can then be performed on each test function of the Test class
15
# This class is heavily inspired by https://www.caktusgroup.com/blog/2016/02/02/writing-unit-tests-django-migrations/
16
class TestMigrations(TestCase):
1✔
17
    @property
1✔
18
    def app(self) -> str:
1✔
19
        app_config = apps.get_containing_app_config(type(self).__module__)
1✔
20
        if app_config is None:
1✔
21
            raise Exception("Could not retrieve app configuration")  # pragma: no cover
×
22
        return app_config.name
1✔
23

24
    migrate_from: str
1✔
25
    migrate_to: str
1✔
26
    apps_registry: StateApps
1✔
27

28
    def setUp(self) -> None:
1✔
29
        assert (
30
            self.migrate_from and self.migrate_to
1✔
31
        ), "TestCase '{}' must define migrate_from and migrate_to     properties".format(
32
            type(self).__name__
33
        )
34
        migrate_from: tuple[str, str] = (self.app, self.migrate_from)
1✔
35
        migrate_to: tuple[str, str] = (self.app, self.migrate_to)
1✔
36
        executor = MigrationExecutor(connection)
1✔
37
        old_apps = executor.loader.project_state(migrate_from).apps
1✔
38

39
        # Reverse to the original migration
40
        executor.migrate([migrate_from])
1✔
41

42
        self.setUpBeforeMigration(old_apps)
1✔
43

44
        # Run the migration to test
45
        executor = MigrationExecutor(connection)
1✔
46
        executor.loader.build_graph()  # reload.
1✔
47
        executor.migrate([migrate_to])
1✔
48

49
        self.apps_registry = executor.loader.project_state(migrate_to).apps
1✔
50

51
    def setUpBeforeMigration(self, apps: StateApps) -> None:
1✔
52
        pass  # pragma: no cover
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc