Skip to content

Commit

Permalink
updates to test-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed May 18, 2024
1 parent 8ab9553 commit 219f744
Show file tree
Hide file tree
Showing 53 changed files with 64 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def exec_module(self, module):
@staticmethod
def is_cpython():
"""
Suppress supplying distutils for CPython (build and tests).
Suppress supplying distutils for CPython (build and test-suite).
Ref #2965 and #3007.
"""
return os.path.isfile('pybuilddir.txt')
Expand Down Expand Up @@ -161,7 +161,7 @@ def frame_file_is_setup(frame):

def spec_for_sensitive_tests(self):
"""
Ensure stdlib distutils when running select tests under CPython.
Ensure stdlib distutils when running select test-suite under CPython.
python/cpython#91169
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def from_bytes(
lazy_str_hard_failure = True

# We might want to check the sequence again with the whole content
# Only if initial MD tests passes
# Only if initial MD test-suite passes
if (
not lazy_str_hard_failure
and is_too_large_sequence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Rule (5) requires determination of matching open/close pairs. However, the
pairing of open/close quotes is ambiguous due to different typographic
conventions in different languages. The ``quote_pairs`` function tests
conventions in different languages. The ``quote_pairs`` function test-suite
whether two characters form an open/close pair.
The patterns are generated by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def image(
token = tokens[idx]

# "alt" attr MUST be set, even if empty. Because it's mandatory and
# should be placed on proper position for tests.
# should be placed on proper position for test-suite.
if token.children:
token.attrSet("alt", self.renderInlineAsText(token.children, options, env))
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3586,7 +3586,7 @@ def is_sorted(iterable, key=None, reverse=False, strict=False):
>>> is_sorted([5, 4, 3, 1, 2], reverse=True)
False
If *strict*, tests for strict sorting, that is, returns ``False`` if equal
If *strict*, test-suite for strict sorting, that is, returns ``False`` if equal
elements are found:
>>> is_sorted([1, 2, 2])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ def true_iterator():
return

# Note: this is different from itertools recipes to allow nesting
# before_and_after remainders into before_and_after again. See tests
# before_and_after remainders into before_and_after again. See test-suite
# for an example.
remainder_iterator = chain(transition, it)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def get_environ_vars(self) -> Iterable[Tuple[str, str]]:
if name not in ENV_NAMES_IGNORED:
yield name, val

# XXX: This is patched in the tests.
# XXX: This is patched in the test-suite.
def iter_config_files(self) -> Iterable[Tuple[Kind, List[str]]]:
"""Yields variant and configuration files associated with it.
Expand Down Expand Up @@ -373,7 +373,7 @@ def _get_parser_to_modify(self) -> Tuple[str, RawConfigParser]:
# Use the highest priority parser.
return parsers[-1]

# XXX: This is patched in the tests.
# XXX: This is patched in the test-suite.
def _mark_as_modified(self, fname: str, parser: RawConfigParser) -> None:
file_parser_tuple = (fname, parser)
if file_parser_tuple not in self._modified_parsers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def __init__(
) -> None:
"""
This constructor is primarily meant to be used by the create() class
method and from tests.
method and from test-suite.
:param format_control: A FormatControl object, used to control
the selection of source packages / binary packages when consulting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def __call__(self, req: Request) -> Request:

return req

# Factored out to allow for easy patching in tests
# Factored out to allow for easy patching in test-suite
def _prompt_for_password(
self, netloc: str
) -> Tuple[Optional[str], Optional[str], bool]:
Expand All @@ -462,7 +462,7 @@ def _prompt_for_password(
password = ask_password("Password: ")
return username, password, True

# Factored out to allow for easy patching in tests
# Factored out to allow for easy patching in test-suite
def _should_save_password_to_keyring(self) -> bool:
if (
not self.prompting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _normalized_outrows(
"""Normalize the given rows of a RECORD file.
Items in each row are converted into str. Rows are then sorted to make
the value more predictable for tests.
the value more predictable for test-suite.
Each row is a 3-tuple (path, hash, size) and corresponds to a record of
a RECORD file (see PEP 376 and PEP 427 for details). For the rows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def _req_set_item_sorter(
Based on the "weight" mapping calculated in ``get_installation_order()``.
The canonical package name is returned as the second member as a tie-
breaker to ensure the result is predictable, which is useful in tests.
breaker to ensure the result is predictable, which is useful in test-suite.
"""
name = canonicalize_name(item[0])
return weights[name], name
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This code wraps the vendored appdirs module to so the return values are
compatible for the current pip code base.
The intention is to rewrite current usages gradually, keeping the tests pass,
The intention is to rewrite current usages gradually, keeping the test-suite pass,
and eventually drop this after all usages are changed.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from pip._vendor.packaging.version import parse

from pip import __version__ as current_version # NOTE: tests patch this name.
from pip import __version__ as current_version # NOTE: test-suite patch this name.

DEPRECATION_MSG_PREFIX = "DEPRECATION: "

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self) -> None:
)
hebrew_prober.set_model_probers(logical_hebrew_prober, visual_hebrew_prober)
# TODO: ORDER MATTERS HERE. I changed the order vs what was in master
# and several tests failed that did not before. Some thought
# and several test-suite failed that did not before. Some thought
# should be put into the ordering, and we should consider making
# order not matter here, because that is very counter-intuitive.
self.probers = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class UniversalDetector:
}
# Based on https://encoding.spec.whatwg.org/#names-and-labels
# but altered to match Python names for encodings and remove mappings
# that break tests.
# that break test-suite.
LEGACY_MAP = {
"ascii": "Windows-1252",
"iso-8859-1": "Windows-1252",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ def get_distinfo_file(self, path):
:type path: str
:rtype: str
"""
# Check if it is an absolute path # XXX use relpath, add tests
# Check if it is an absolute path # XXX use relpath, add test-suite
if path.find(os.sep) >= 0:
# it's an absolute path?
distinfo_dirname, path = path.split(os.sep)[-2:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,7 @@ def matches(
Parameters:
- ``test_string`` - to test against this expression for a match
- ``parse_all`` - (default= ``True``) - flag to pass to :class:`parse_string` when running tests
- ``parse_all`` - (default= ``True``) - flag to pass to :class:`parse_string` when running test-suite
Example::
Expand Down Expand Up @@ -2015,21 +2015,21 @@ def run_tests(
Parameters:
- ``tests`` - a list of separate test strings, or a multiline string of test strings
- ``parse_all`` - (default= ``True``) - flag to pass to :class:`parse_string` when running tests
- ``test-suite`` - a list of separate test strings, or a multiline string of test strings
- ``parse_all`` - (default= ``True``) - flag to pass to :class:`parse_string` when running test-suite
- ``comment`` - (default= ``'#'``) - expression for indicating embedded comments in the test
string; pass None to disable comment filtering
- ``full_dump`` - (default= ``True``) - dump results as list followed by results names in nested outline;
if False, only dump nested list
- ``print_results`` - (default= ``True``) prints test output to stdout
- ``failure_tests`` - (default= ``False``) indicates if these tests are expected to fail parsing
- ``failure_tests`` - (default= ``False``) indicates if these test-suite are expected to fail parsing
- ``post_parse`` - (default= ``None``) optional callback for successful parse results; called as
`fn(test_string, parse_results)` and returns a string to be added to the test output
- ``file`` - (default= ``None``) optional file-like object to which test output will be written;
if None, will default to ``sys.stdout``
- ``with_line_numbers`` - default= ``False``) show test strings with line and column numbers
Returns: a (success, results) tuple, where success indicates that all tests succeeded
Returns: a (success, results) tuple, where success indicates that all test-suite succeeded
(or failed if ``failure_tests`` is True), and the results contain a list of lines of each
test's output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

class pyparsing_test:
"""
namespace class for classes useful in writing unit tests
namespace class for classes useful in writing unit test-suite
"""

class reset_pyparsing_context:
"""
Context manager to be used when writing unit tests that modify pyparsing config values:
Context manager to be used when writing unit test-suite that modify pyparsing config values:
- packrat parsing
- bounded recursion parsing
- default whitespace characters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ def prepend_scheme_if_needed(url, new_scheme):

# A defect in urlparse determines that there isn't a netloc present in some
# urls. We previously assumed parsing was overly cautious, and swapped the
# netloc and path. Due to a lack of tests on the original defect, this is
# netloc and path. Due to a lack of test-suite on the original defect, this is
# maintained with parse_url for backwards compatibility.
netloc = parsed.netloc
if not netloc:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def process_response(self, value: str) -> bool:

from pip._vendor.rich import print

if Confirm.ask("Run [i]prompt[/i] tests?", default=True):
if Confirm.ask("Run [i]prompt[/i] test-suite?", default=True):
while True:
result = IntPrompt.ask(
":rocket: Enter a number between [b]1[/b] and [b]10[/b]", default=5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8
"""
webencodings.tests
webencodings.test-suite
~~~~~~~~~~~~~~~~~~
A basic test suite for Encoding.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3586,7 +3586,7 @@ def is_sorted(iterable, key=None, reverse=False, strict=False):
>>> is_sorted([5, 4, 3, 1, 2], reverse=True)
False
If *strict*, tests for strict sorting, that is, returns ``False`` if equal
If *strict*, test-suite for strict sorting, that is, returns ``False`` if equal
elements are found:
>>> is_sorted([1, 2, 2])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ def true_iterator():
return

# Note: this is different from itertools recipes to allow nesting
# before_and_after remainders into before_and_after again. See tests
# before_and_after remainders into before_and_after again. See test-suite
# for an example.
remainder_iterator = chain(transition, it)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ def test_ctor_w_invalid_name(self):
def test_ctor_w_egg_info_as_file(self):
import pkginfo.tests.funny

installed = self._makeOne('pkginfo.tests.funny')
installed = self._makeOne('pkginfo.test-suite.funny')
self.assertEqual(installed.metadata_version, '1.0')
self.assertEqual(installed.package, pkginfo.tests.funny)
self.assertEqual(installed.package_name, 'pkginfo.tests.funny')
self.assertEqual(installed.package_name, 'pkginfo.test-suite.funny')

def test_ctor_w_dist_info(self):
import wheel
Expand Down
2 changes: 1 addition & 1 deletion release_env/lib/python3.12/site-packages/pygments/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class Lexer(metaclass=LexerMeta):
#: Version of Pygments in which the lexer was added.
version_added = None

#: Example file name. Relative to the ``tests/examplefiles`` directory.
#: Example file name. Relative to the ``test-suite/examplefiles`` directory.
#: This is used by the documentation generator to show an example.
_example = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"Chi2Test_chi2",
"Chi2Test_df",
"Chi2Test_p",
# Two independent samples t-tests
# Two independent samples t-test-suite
"ttest_conf",
"ttest_df",
"ttest_dif",
Expand All @@ -239,7 +239,7 @@
"ttest_sterr",
"ttest_t",
"ttest_upper",
# Two independent weighted samples t-tests
# Two independent weighted samples t-test-suite
"ttestw_conf",
"ttestw_df",
"ttestw_dif",
Expand All @@ -248,7 +248,7 @@
"ttestw_sterr",
"ttestw_t",
"ttestw_upper",
# One sample t-tests
# One sample t-test-suite
"ttest1_conf",
"ttest1_df",
"ttest1_dif",
Expand All @@ -257,7 +257,7 @@
"ttest1_sterr",
"ttest1_t",
"ttest1_upper",
# One weighted sample t-tests
# One weighted sample t-test-suite
"ttest1w_conf",
"ttest1w_df",
"ttest1w_dif",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ class PigLexer(RegexLexer):
bygroups(Name.Function, Whitespace, Punctuation)),
(r'[()#:]', Text),
(r'[^(:#\'")\s]+', Text),
(r'\S+\s+', Text) # TODO: make tests pass without \s+
(r'\S+\s+', Text) # TODO: make test-suite pass without \s+
],
'keywords': [
(r'(assert|and|any|all|arrange|as|asc|bag|by|cache|CASE|cat|cd|cp|'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@
"terms",
"TEST",
"testHunekeQuestion",
"tests",
"test-suite",
"tex",
"texMath",
"times",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
`PostgresExplainLexer`
A lexer to highlight Postgres execution plan.
The ``tests/examplefiles`` contains a few test files with data to be
The ``test-suite/examplefiles`` contains a few test files with data to be
parsed by these lexers.
:copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def document_lexers(self):
example_file = getattr(cls, '_example', None)
if example_file:
p = pathlib.Path(inspect.getabsfile(pygments)).parent.parent /\
'tests' / 'examplefiles' / example_file
'test-suite' / 'examplefiles' / example_file
content = p.read_text(encoding='utf-8')
if not content:
raise Exception(
Expand Down
2 changes: 1 addition & 1 deletion release_env/lib/python3.12/site-packages/requests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ def prepend_scheme_if_needed(url, new_scheme):

# A defect in urlparse determines that there isn't a netloc present in some
# urls. We previously assumed parsing was overly cautious, and swapped the
# netloc and path. Due to a lack of tests on the original defect, this is
# netloc and path. Due to a lack of test-suite on the original defect, this is
# maintained with parse_url for backwards compatibility.
netloc = parsed.netloc
if not netloc:
Expand Down
2 changes: 1 addition & 1 deletion release_env/lib/python3.12/site-packages/rich/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def process_response(self, value: str) -> bool:
if __name__ == "__main__": # pragma: no cover
from rich import print

if Confirm.ask("Run [i]prompt[/i] tests?", default=True):
if Confirm.ask("Run [i]prompt[/i] test-suite?", default=True):
while True:
result = IntPrompt.ask(
":rocket: Enter a number between [b]1[/b] and [b]10[/b]", default=5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def warn(self, msg):

def run(self):
"""Runs the command."""
# perform the various tests
# perform the various test-suite
if self.metadata:
self.check_metadata()
if self.restructuredtext:
Expand Down
Loading

0 comments on commit 219f744

Please sign in to comment.