Skip to content

[Random Crash] Usually during unittests #472

@DEKHTIARJonathan

Description

@DEKHTIARJonathan

I'm having a weird crash - totally random and hard to reproduce:

tests/factories.py:68: in ProjectFactory
    country = random.choice(countries)[0]
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/random.py:352: in choice
    return seq[self._randbelow(len(seq))]
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/site-packages/django_countries/__init__.py:588: in __getitem__
    return next(itertools.islice(self.__iter__(), index, index + 1))
E   StopIteration

Probably means that self.__iter__() returns an empty result for some reasons.
I believe it may happen when something doesn't get initialized. No idea what and why.

Any idea what the issue could be ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions