Skip to content

Commit

Permalink
Fix done in explore_features to properly deal with Windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
anibalinn committed Nov 22, 2024
1 parent 06bbcfe commit 154dbd6
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions behavex/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,28 +173,37 @@ def join_scenario_reports(json_reports):
)
return list(result.values())


def explore_features(features_path, features_list=None):
if features_list is None:
features_list = []

# Normalize path separators
features_path = os.path.normpath(features_path)

if global_vars.rerun_failures or ".feature:" in features_path:
features_path = features_path.split(":")[0]

if os.path.isfile(features_path):
if features_path.endswith('.feature'):
path_feature = os.path.abspath(features_path)
feature = should_feature_be_run(path_feature)
if feature:
features_list.extend(feature.scenarios)
else:
for node in os.listdir(features_path):
if os.path.isdir(os.path.join(features_path, node)):
explore_features(os.path.join(features_path, node), features_list)
else:
if node.endswith('.feature'):
path_feature = os.path.abspath(os.path.join(features_path, node))
try:
for node in os.listdir(features_path):
node_path = os.path.join(features_path, node)
if os.path.isdir(node_path):
explore_features(node_path, features_list)
elif node.endswith('.feature'):
path_feature = os.path.abspath(node_path)
feature = should_feature_be_run(path_feature)
if feature:
features_list.extend(feature.scenarios)
except OSError as e:
print(f"Error accessing path {features_path}: {e}")
return features_list

return features_list


Expand Down

0 comments on commit 154dbd6

Please sign in to comment.