stats/tests.py::TestStats::test_store_daily_stats_with_accounts

First seen 1 year, 9 months ago in commit 1cd3a pushed by Anže Pečar

Last 100 Runs
Pass % 100.0%
p50 duration 0.0899s
p95 duration 0.0960s

40 runs 40 passed in the last 30 days

Run 1 year, 5 months ago
Status PASS
Commit

Index discuss.systems

Commit 43e9e pushed by Anže Pečar
Run 1 year, 5 months ago
Status PASS
Commit

Don't index account that haven't posted in a while

Commit 9a7e5 pushed by Anže Pečar
Run 1 year, 5 months ago
Status PASS
Commit

Add typescript and kubernetes stats columns

Commit 25782 pushed by Anže Pečar
Run 1 year, 5 months ago
Status FAIL
Commit

Add kubernetes

Commit dc0a9 pushed by Anže Pečar
Repr
self = <QuerySet []>
defaults = {'angular_accounts': 0, 'angular_posts': 0, 'bootstrap_accounts': 0, 'bootstrap_posts': 0, ...}
kwargs = {'date': datetime.datetime(2024, 3, 22, 0, 0, tzinfo=datetime.timezone.utc)}

    def get_or_create(self, defaults=None, **kwargs):
        """
        Look up an object with the given kwargs, creating one if necessary.
        Return a tuple of (object, created), where created is a boolean
        specifying whether an object was created.
        """
        # The get() needs to be targeted at the write database in order
        # to avoid potential transaction consistency problems.
        self._for_write = True
        try:
>           return self.get(**kwargs), False

/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/django/db/models/query.py:948: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <QuerySet []>, args = ()
kwargs = {'date': datetime.datetime(2024, 3, 22, 0, 0, tzinfo=datetime.timezone.utc)}
clone = <QuerySet []>, limit = 21, num = 0

    def get(self, *args, **kwargs):
        """
        Perform the query and return a single object matching the given
        keyword arguments.
        """
        if self.query.combinator and (args or kwargs):
            raise NotSupportedError(
                "Calling QuerySet.get(...) with filters after %s() is not "
                "supported." % self.query.combinator
            )
        clone = self._chain() if self.query.combinator else self.filter(*args, **kwargs)
        if self.query.can_filter() and not self.query.distinct_fields:
            clone = clone.order_by()
        limit = None
        if (
            not clone.query.select_for_update
            or connections[clone.db].features.supports_select_for_update_with_limit
        ):
            limit = MAX_GET_RESULTS
            clone.query.set_limits(high=limit)
        num = len(clone)
        if num == 1:
            return clone._result_cache[0]
        if not num:
>           raise self.model.DoesNotExist(
                "%s matching query does not exist." % self.model._meta.object_name
            )
E           stats.models.Daily.DoesNotExist: Daily matching query does not exist.

/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/django/db/models/query.py:649: DoesNotExist

During handling of the above exception, another exception occurred:

self = <stats.tests.TestStats testMethod=test_store_daily_stats_with_accounts>

    def test_store_daily_stats_with_accounts(self):
        account = Account.objects.create(
            account_id="2",
            instance="fosstodon.org",
            username="fosstest",
            acct="fosstest",
            display_name="Test Foss",
            locked=False,
            bot=False,
            discoverable=True,
            group=False,
            created_at="2021-01-01T00:00:00.000000+00:00",
            last_status_at="2021-01-01T00:00:00.000000+00:00",
            last_sync_at="2021-01-01T00:00:00.000000+00:00",
            followers_count=0,
            following_count=0,
            statuses_count=0,
            note="",
            url="https://fosstodon.org/@fosstest",
            avatar="https://fosstodon.org/@fosstest/avatar",
            avatar_static="https://fosstodon.org/@fosstest/avatar",
            header="https://fosstodon.org/@fosstest/header",
            header_static="https://fosstodon.org/@fosstest/header",
            emojis=[],
            roles=[],
            fields=[],
        )
        AccountLookup.objects.create(account=account, language="python")
    
>       store_daily_stats()

stats/tests.py:56: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
stats/models.py:25: in store_daily_stats
    Daily.objects.update_or_create(date=today, defaults=account_defaults | post_defaults)
/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/django/db/models/manager.py:87: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/django/db/models/query.py:986: in update_or_create
    obj, created = self.select_for_update().get_or_create(
/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/django/db/models/query.py:950: in get_or_create
    params = self._extract_model_params(defaults, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <QuerySet []>
defaults = {'angular_accounts': 0, 'angular_posts': 0, 'bootstrap_accounts': 0, 'bootstrap_posts': 0, ...}
kwargs = {'date': datetime.datetime(2024, 3, 22, 0, 0, tzinfo=datetime.timezone.utc)}
params = {'angular_accounts': 0, 'angular_posts': 0, 'bootstrap_accounts': 0, 'bootstrap_posts': 0, ...}
property_names = frozenset({'pk'})
invalid_params = ['typescript_accounts', 'kubernetes_accounts', 'typescript_posts', 'kubernetes_posts']
param = 'total_posts'

    def _extract_model_params(self, defaults, **kwargs):
        """
        Prepare `params` for creating a model instance based on the given
        kwargs; for use by get_or_create().
        """
        defaults = defaults or {}
        params = {k: v for k, v in kwargs.items() if LOOKUP_SEP not in k}
        params.update(defaults)
        property_names = self.model._meta._property_names
        invalid_params = []
        for param in params:
            try:
                self.model._meta.get_field(param)
            except exceptions.FieldDoesNotExist:
                # It's okay to use a model's property if it has a setter.
                if not (param in property_names and getattr(self.model, param).fset):
                    invalid_params.append(param)
        if invalid_params:
>           raise exceptions.FieldError(
                "Invalid field name(s) for model %s: '%s'."
                % (
                    self.model._meta.object_name,
                    "', '".join(sorted(invalid_params)),
                )
            )
E           django.core.exceptions.FieldError: Invalid field name(s) for model Daily: 'kubernetes_accounts', 'kubernetes_posts', 'typescript_accounts', 'typescript_posts'.

/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/django/db/models/query.py:1039: FieldError
Run 1 year, 5 months ago
Status PASS
Commit

Add puet instance

Commit b2bb7 pushed by Anže Pečar
Run 1 year, 5 months ago
Status PASS
Commit

Fix sentry issue

Commit 19536 pushed by Anže Pečar
Run 1 year, 5 months ago
Status PASS
Commit

Fix case where display_name is not set

Commit fc792 pushed by Anže Pečar
Run 1 year, 5 months ago
Status PASS
Commit

Merge pull request #19 from anze3db/pre-commit-ci-update-config

Commit 215e3 pushed by Anže Pečar
Run 1 year, 5 months ago
Status PASS
Commit

Merge pull request #20 from anze3db/setup_pip_install

Commit cf326 pushed by Anže Pečar
Run 1 year, 5 months ago
Status PASS
Commit

Merge 954e76dc7f40772ff1769878eb87d84814719f3c into 22dbcd4ee6eba670f3b9717d72100798f1bab5e1

Commit 4ac21 pushed by Gašper Martič
Run 1 year, 6 months ago
Status PASS
Commit

Merge e00b6da96e75287c580cef1a212fc29410d5392f into 22dbcd4ee6eba670f3b9717d72100798f1bab5e1

Commit 93288 pushed by pre-commit-ci[bot]
Run 1 year, 6 months ago
Status PASS
Commit

Add instructions for dev env

Commit 22dbc pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

Merge pull request #15 from anze3db/pre-commit-ci-update-config

Commit 6561b pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

Merge 300f5da759c271084daa8005ced3342b487e564f into 8e2605c36f42cef43e1ae6d69c5bcc77aea848c0

Commit 84328 pushed by pre-commit-ci[bot]
Run 1 year, 6 months ago
Status PASS
Commit

Merge 41f3e88687737313c442a06fd0b50683c272ad18 into 8e2605c36f42cef43e1ae6d69c5bcc77aea848c0

Commit 707c5 pushed by pre-commit-ci[bot]
Run 1 year, 6 months ago
Status PASS
Commit

Prevent accounts with 0 posts from being shown

Commit 8e260 pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

Improve performance even more

Commit e1928 pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

More perf improvements

Commit a033a pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

Make sure to always update counts

Commit cef5a pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

Switch to a more efficient query for most active accounts

Commit 8104d pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

Fix daily account stats

Commit 5d590 pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

Fix dedent

Commit da6f1 pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

Add top daily growth

Commit d4b98 pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

Start calculating daily change

Commit 8f142 pushed by Anže Pečar
Run 1 year, 6 months ago
Status PASS
Commit

Start tracking daily number of followers, posts and following

Commit 66024 pushed by Anže Pečar