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

Drop dependency on glob2 #570

Merged
merged 1 commit into from Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 2 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pyproject.toml
Expand Up @@ -35,7 +35,6 @@ classifiers = [

[tool.poetry.dependencies]
python = "^3.7"
glob2 = "*"
Mako = "*"
parse = "*"
parse-type = "*"
Expand Down Expand Up @@ -83,5 +82,5 @@ warn_unused_configs = true
files = "src/pytest_bdd/**/*.py"

[[tool.mypy.overrides]]
module = ["parse", "parse_type", "glob2"]
module = ["parse", "parse_type"]
ignore_missing_imports = true
7 changes: 4 additions & 3 deletions src/pytest_bdd/feature.py
Expand Up @@ -25,10 +25,9 @@
"""
from __future__ import annotations

import glob
import os.path

import glob2

from .parser import Feature, parse_feature

# Global features dictionary
Expand Down Expand Up @@ -70,7 +69,9 @@ def get_features(paths: list[str], **kwargs) -> list[Feature]:
if path not in seen_names:
seen_names.add(path)
if os.path.isdir(path):
features.extend(get_features(glob2.iglob(os.path.join(path, "**", "*.feature")), **kwargs))
features.extend(
get_features(glob.iglob(os.path.join(path, "**", "*.feature"), recursive=True), **kwargs)
)
else:
base, name = os.path.split(path)
feature = get_feature(base, name, **kwargs)
Expand Down
5 changes: 2 additions & 3 deletions src/pytest_bdd/scripts.py
Expand Up @@ -2,11 +2,10 @@
from __future__ import annotations

import argparse
import glob
import os.path
import re

import glob2

from .generation import generate_code, parse_feature_files

MIGRATE_REGEX = re.compile(r"\s?(\w+)\s=\sscenario\((.+)\)", flags=re.MULTILINE)
Expand All @@ -15,7 +14,7 @@
def migrate_tests(args: argparse.Namespace) -> None:
"""Migrate outdated tests to the most recent form."""
path = args.path
for file_path in glob2.iglob(os.path.join(os.path.abspath(path), "**", "*.py")):
for file_path in glob.iglob(os.path.join(os.path.abspath(path), "**", "*.py"), recursive=True):
migrate_tests_in_file(file_path)


Expand Down