stats/tests.py::TestStats::test_posts_from_yesterday_are_updated

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

Last 100 Runs
Pass % 100.0%
p50 duration 0.1059s
p95 duration 0.1140s

11 runs 11 passed in the last 30 days

Run 1 year, 1 month ago
Status PASS
Commit

Fix `darkMode` flicker (#30)

Commit ce01b pushed by Ivan Križnar
Run 1 year, 1 month ago
Status PASS
Commit

Fix sorting langs and frameworks

Commit 5801f pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

New v2 design (#29)

Commit c8fa1 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Merge d027dae6e71d4d0d38b3ec5aeac267081f471a62 into e29a8b317ace486c54dd87fead07f38024008a9f

Commit f3c13 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Merge 3ac1c3708a64bd1a156bcc228c5e1a04ef7ab2b0 into e29a8b317ace486c54dd87fead07f38024008a9f

Commit 41971 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Merge 6ff651e07d6cdfc5f858cc60925dd88c7b8de405 into e29a8b317ace486c54dd87fead07f38024008a9f

Commit aee09 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

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

Commit e29a8 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Filter out Julians

Commit 36739 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Merge 3ec81b20b57e3c7bb0f562191ca50c122d9866cc into d373df6c1eea1dd238e9144d193068356cfb6c7d

Commit 597b6 pushed by pre-commit-ci[bot]
Run 1 year, 1 month ago
Status PASS
Commit

Add watchman and bump dependencies

Commit d373d pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Mention contributiors

Commit 7ae67 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Add a bit of a background to image when they don't load

Commit 36659 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Merge pull request #25 from anze3db/masonry-layout

Commit 1fbde pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Clarify README about initial database load #26

Commit e705b pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Add migrations for Julia

Commit 05692 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Merge 249b120eb9eff71db090b258532030f3d6a067ca into 967f85d97cc04b32e4031bf74e7ba8334c2e070f

Commit 5679e pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Merge 606453d4b7d102c11a22b152a154c230a6d559af into 967f85d97cc04b32e4031bf74e7ba8334c2e070f

Commit 3bdbf pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Merge c25a95fcbd7084438c6b3fae22f3d5a54ff59b89 into 967f85d97cc04b32e4031bf74e7ba8334c2e070f

Commit 83608 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Merge pull request #23 from levlaz/patch-1

Commit 967f8 pushed by Anže Pečar
Run 1 year, 1 month ago
Status PASS
Commit

Index discuss.systems

Commit 43e9e pushed by Anže Pečar
Run 1 year, 1 month 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, 1 month ago
Status PASS
Commit

Add typescript and kubernetes stats columns

Commit 25782 pushed by Anže Pečar
Run 1 year, 1 month 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_posts_from_yesterday_are_updated>

    def test_posts_from_yesterday_are_updated(self):
        today = timezone.now()
        yesterday = today - dt.timedelta(days=1)
    
        yesterday_stats = Daily.objects.create(
            date=yesterday.date(),
            total_accounts=2,
            python_accounts=1,
            javascript_accounts=0,
            rust_accounts=0,
            ruby_accounts=0,
            golang_accounts=0,
            java_accounts=0,
            kotlin_accounts=0,
            scala_accounts=0,
            swift_accounts=0,
            csharp_accounts=0,
            fsharp_accounts=0,
            dotnet_accounts=0,
            cpp_accounts=0,
            linux_accounts=0,
            haskell_accounts=0,
            ocaml_accounts=0,
            nix_accounts=0,
            opensource_accounts=0,
            php_accounts=0,
        )
        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")
        Post.objects.create(
            account=account,
            post_id="0",
            url="https://fosstodon.org/@fosstest/1",
            created_at=yesterday.isoformat(),
            content="Hello, world!",
            reblog=False,
            sensitive=False,
            spoiler_text="",
            visibility="public",
            language="python",
            emojis=[],
            replies_count=0,
            reblogs_count=0,
            favourites_count=0,
            mentions=[],
            tags=[],
        )
        Post.objects.create(
            account=account,
            post_id="1",
            url="https://fosstodon.org/@fosstest/1",
            created_at=today.isoformat(),
            content="Hello, world!",
            reblog=False,
            sensitive=False,
            spoiler_text="",
            visibility="public",
            language="python",
            replies_count=0,
            reblogs_count=0,
            favourites_count=0,
            emojis=[],
            mentions=[],
            tags=[],
        )
>       store_daily_stats()

stats/tests.py:152: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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, 1 month ago
Status PASS
Commit

Add puet instance

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

Fix sentry issue

Commit 19536 pushed by Anže Pečar