Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Midnight bug: test_share_owner_list_filters #561

Open
crosspolar opened this issue Sep 28, 2024 · 1 comment
Open

Midnight bug: test_share_owner_list_filters #561

crosspolar opened this issue Sep 28, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@crosspolar
Copy link
Contributor

Shortly after midnight, Github Actions fails the testing-workflow here:

=================================== FAILURES ===================================
______________________ TestShareOwnerList.test_has_status ______________________

self = <tapir.coop.tests.test_share_owner_list_filters.TestShareOwnerList testMethod=test_has_status>

    def test_has_status(self):
        share_owners_with_status_sold = [
            ShareOwnerFactory.create(),
            TapirUserFactory.create().share_owner,
        ]
        for share_ownership in ShareOwnership.objects.filter(
            share_owner__in=share_owners_with_status_sold
        ):
            share_ownership.end_date = timezone.now() - datetime.timedelta(days=1)
            share_ownership.save()
    
        share_owners_with_status_investing = [
            ShareOwnerFactory.create(),
            TapirUserFactory.create().share_owner,
        ]
        for share_owner in share_owners_with_status_investing:
            share_owner.is_investing = True
            share_owner.save()
    
        share_owners_with_status_active = [
            ShareOwnerFactory.create(),
            TapirUserFactory.create().share_owner,
        ]
        for share_owner in share_owners_with_status_active:
            share_owner.is_investing = False
            share_owner.save()
    
>       self.visit_view(
            {"status": MemberStatus.SOLD},
            must_be_in=share_owners_with_status_sold,
            must_be_out=share_owners_with_status_investing
            + share_owners_with_status_active,
        )

tapir/coop/tests/test_share_owner_list_filters.py:288: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tapir/coop/tests/test_share_owner_list_filters.py:40: in visit_view
    self.assertIn(
E   AssertionError: <ShareOwner: ShareOwner object (243)> not found in <django_tables2.data.TableQuerysetData object at 0x7f68ae6a9700> : Lindsey Hinton #243 should show up in the list filtered by status=sold.

Some hours later it's fine again. I assume it's some timezone and datetime problem

@crosspolar crosspolar added the bug Something isn't working label Sep 28, 2024
@Theophile-Madet Theophile-Madet moved this to Small improvements in Tapir Roadmap Sep 30, 2024
@Theophile-Madet
Copy link
Contributor

Interesting 😅
We'd need to mock the time instead of doing this relative to the actual time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Small improvements
Development

No branches or pull requests

2 participants