forked from WeblateOrg/weblate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use locks to prevent concurrent parsing
The parser instances cannot be shared between threads as PyParsing is not thread-safe, see pyparsing/pyparsing#89. Fixes WEBLATE-1MFM
- Loading branch information
Showing
7 changed files
with
58 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# Copyright © Michal Čihař <[email protected]> | ||
# | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
from __future__ import annotations | ||
|
||
from datetime import UTC, datetime, timedelta | ||
from typing import Literal | ||
|
||
from django.db.models import F, Q | ||
from django.test import TestCase | ||
|
@@ -24,7 +26,7 @@ | |
|
||
class SearchTestCase(TestCase): | ||
object_class = Unit | ||
parser = "unit" | ||
parser: Literal["unit", "user", "superuser"] = "unit" | ||
|
||
def assert_query(self, string, expected, exists=False, **context) -> None: | ||
result = parse_query(string, parser=self.parser, **context) | ||
|