stats/tests.py::TestStats::test_store_daily_stats_with_accounts

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

Last 100 Runs
Pass % 100.0%
p50 duration 0.0953s
p95 duration 0.1006s

39 runs 39 passed in the last 30 days

Run 8 months, 1 week ago
Status PASS
Commit

query string on conference page

Commit 5f092 pushed by Anže Pečar
Run 8 months, 1 week ago
Status PASS
Commit

Try out Django 5.1a1

Commit 2242d pushed by Anže Pečar
Run 8 months, 1 week ago
Status PASS
Commit

Fix styles

Commit 532df pushed by Anže Pečar
Run 8 months, 1 week ago
Status PASS
Commit

[pre-commit.ci] pre-commit autoupdate (#44)

Commit 6845e pushed by pre-commit-ci[bot]
Run 8 months, 1 week ago
Status PASS
Commit

Merge 80112a958c5f2cee1010b4f92e26576582a33cf2 into 89b2d6593b0ef300a7bf79290a1f998fa44b1420

Commit c8203 pushed by pre-commit-ci[bot]
Run 8 months, 1 week ago
Status PASS
Commit

Another improvement

Commit 89b2d pushed by Anže Pečar
Run 8 months, 1 week ago
Status PASS
Commit

Improve navigation

Commit 8cb28 pushed by Anže Pečar
Run 8 months, 1 week ago
Status PASS
Commit

Update styles

Commit 5197a pushed by Anže Pečar
Run 8 months, 1 week ago
Status PASS
Commit

Remove horizontal scroll on mobile

Commit 753fa pushed by Anže Pečar
Run 8 months, 2 weeks ago
Status PASS
Commit

Add new instances for index

Commit 4ac66 pushed by Anže Pečar
Run 8 months, 2 weeks ago
Status PASS
Commit

Rename the columns

Commit 1a192 pushed by Anže Pečar
Run 8 months, 2 weeks ago
Status FAIL
Commit

Account for posts in optimizer

Commit 9e3fa 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, 5, 18, 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.3/x64/lib/python3.12/site-packages/django/db/models/query.py:948: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <QuerySet []>, args = ()
kwargs = {'date': datetime.datetime(2024, 5, 18, 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.3/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.3/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.3/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.3/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, 5, 18, 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 = ['rstats_accounts', 'rstats_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: 'rstats_accounts', 'rstats_posts'.

/opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/site-packages/django/db/models/query.py:1039: FieldError
Run 8 months, 2 weeks ago
Status PASS
Commit

Add R lang

Commit ee137 pushed by Anže Pečar
Run 8 months, 2 weeks ago
Status PASS
Commit

Improve text hierarchy in side bar

Commit a001f pushed by Anže Pečar
Run 8 months, 3 weeks ago
Status PASS
Commit

[pre-commit.ci] pre-commit autoupdate (#42)

Commit c6109 pushed by pre-commit-ci[bot]
Run 8 months, 3 weeks ago
Status PASS
Commit

Lint template files

Commit b2169 pushed by Anže Pečar
Run 8 months, 3 weeks ago
Status PASS
Commit

Fix lint error

Commit 8fcba pushed by Anže Pečar
Run 8 months, 3 weeks ago
Status PASS
Commit

Merge d93cca3418fc409494d3b1c501cdef0a97e7e35c into 3333dc3a7b12cb009acc4cc36eff989df52e4cd5

Commit 0e3f6 pushed by pre-commit-ci[bot]
Run 8 months, 3 weeks ago
Status PASS
Commit

Merge 3e9a23fec0c22a0917500cc51af6dd0d92f44f8e into 3333dc3a7b12cb009acc4cc36eff989df52e4cd5

Commit fbf9c pushed by pre-commit-ci[bot]
Run 8 months, 3 weeks ago
Status PASS
Commit

Cleanup follow_response

Commit 3333d pushed by Anže Pečar
Run 8 months, 3 weeks ago
Status PASS
Commit

Remove debug

Commit 0f3c7 pushed by Anže Pečar
Run 8 months, 3 weeks ago
Status PASS
Commit

Better messaging

Commit 11efa pushed by Anže Pečar
Run 8 months, 3 weeks ago
Status PASS
Commit

Quick and dirty way to handle moved accounts

Commit 2157f pushed by Anže Pečar
Run 8 months, 4 weeks ago
Status PASS
Commit

Make sure to index robpike!

Commit f9acd pushed by Anže Pečar
Run 8 months, 4 weeks ago
Status PASS
Commit

More facelift

Commit 5ab43 pushed by Anže Pečar