mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-07 20:26:54 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
72ad6dc953
commit
f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions
|
|
@ -1,23 +1,24 @@
|
|||
import os
|
||||
import operator
|
||||
import sys
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import itertools
|
||||
import operator
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from distutils.errors import DistutilsError, DistutilsOptionError
|
||||
from distutils import log
|
||||
from unittest import TestLoader
|
||||
|
||||
from pkg_resources import (
|
||||
resource_listdir,
|
||||
resource_exists,
|
||||
normalize_path,
|
||||
working_set,
|
||||
evaluate_marker,
|
||||
add_activation_listener,
|
||||
require,
|
||||
EntryPoint,
|
||||
)
|
||||
from distutils import log
|
||||
from distutils.errors import DistutilsError
|
||||
from distutils.errors import DistutilsOptionError
|
||||
from pkg_resources import add_activation_listener
|
||||
from pkg_resources import EntryPoint
|
||||
from pkg_resources import evaluate_marker
|
||||
from pkg_resources import normalize_path
|
||||
from pkg_resources import require
|
||||
from pkg_resources import resource_exists
|
||||
from pkg_resources import resource_listdir
|
||||
from pkg_resources import working_set
|
||||
from setuptools import Command
|
||||
from setuptools.extern.more_itertools import unique_everseen
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ class ScanningLoader(TestLoader):
|
|||
tests = []
|
||||
tests.append(TestLoader.loadTestsFromModule(self, module))
|
||||
|
||||
if hasattr(module, "additional_tests"):
|
||||
if hasattr(module, 'additional_tests'):
|
||||
tests.append(module.additional_tests())
|
||||
|
||||
if hasattr(module, '__path__'):
|
||||
|
|
@ -75,7 +76,7 @@ class NonDataProperty:
|
|||
class test(Command):
|
||||
"""Command to run unit tests after in-place build"""
|
||||
|
||||
description = "run unit tests after in-place build (deprecated)"
|
||||
description = 'run unit tests after in-place build (deprecated)'
|
||||
|
||||
user_options = [
|
||||
('test-module=', 'm', "Run 'test_suite' in specified module"),
|
||||
|
|
@ -84,7 +85,7 @@ class test(Command):
|
|||
's',
|
||||
"Run single test, case or suite (e.g. 'module.test_suite')",
|
||||
),
|
||||
('test-runner=', 'r', "Test runner to use"),
|
||||
('test-runner=', 'r', 'Test runner to use'),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
|
|
@ -96,19 +97,19 @@ class test(Command):
|
|||
def finalize_options(self):
|
||||
|
||||
if self.test_suite and self.test_module:
|
||||
msg = "You may specify a module or a suite, but not both"
|
||||
msg = 'You may specify a module or a suite, but not both'
|
||||
raise DistutilsOptionError(msg)
|
||||
|
||||
if self.test_suite is None:
|
||||
if self.test_module is None:
|
||||
self.test_suite = self.distribution.test_suite
|
||||
else:
|
||||
self.test_suite = self.test_module + ".test_suite"
|
||||
self.test_suite = self.test_module + '.test_suite'
|
||||
|
||||
if self.test_loader is None:
|
||||
self.test_loader = getattr(self.distribution, 'test_loader', None)
|
||||
if self.test_loader is None:
|
||||
self.test_loader = "setuptools.command.test:ScanningLoader"
|
||||
self.test_loader = 'setuptools.command.test:ScanningLoader'
|
||||
if self.test_runner is None:
|
||||
self.test_runner = getattr(self.distribution, 'test_runner', None)
|
||||
|
||||
|
|
@ -139,7 +140,7 @@ class test(Command):
|
|||
self.reinitialize_command('build_ext', inplace=1)
|
||||
self.run_command('build_ext')
|
||||
|
||||
ei_cmd = self.get_finalized_command("egg_info")
|
||||
ei_cmd = self.get_finalized_command('egg_info')
|
||||
|
||||
old_path = sys.path[:]
|
||||
old_modules = sys.modules.copy()
|
||||
|
|
@ -149,7 +150,7 @@ class test(Command):
|
|||
sys.path.insert(0, project_path)
|
||||
working_set.__init__()
|
||||
add_activation_listener(lambda dist: dist.activate())
|
||||
require('%s==%s' % (ei_cmd.egg_name, ei_cmd.egg_version))
|
||||
require('{}=={}'.format(ei_cmd.egg_name, ei_cmd.egg_version))
|
||||
with self.paths_on_pythonpath([project_path]):
|
||||
yield
|
||||
finally:
|
||||
|
|
@ -201,10 +202,10 @@ class test(Command):
|
|||
|
||||
def run(self):
|
||||
self.announce(
|
||||
"WARNING: Testing via this command is deprecated and will be "
|
||||
"removed in a future version. Users looking for a generic test "
|
||||
"entry point independent of test runner are encouraged to use "
|
||||
"tox.",
|
||||
'WARNING: Testing via this command is deprecated and will be '
|
||||
'removed in a future version. Users looking for a generic test '
|
||||
'entry point independent of test runner are encouraged to use '
|
||||
'tox.',
|
||||
log.WARN,
|
||||
)
|
||||
|
||||
|
|
@ -248,5 +249,5 @@ class test(Command):
|
|||
"""
|
||||
if val is None:
|
||||
return
|
||||
parsed = EntryPoint.parse("x=" + val)
|
||||
parsed = EntryPoint.parse('x=' + val)
|
||||
return parsed.resolve()()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue