Skip to content

Commit

Permalink
chore: dynamic to load features
Browse files Browse the repository at this point in the history
  • Loading branch information
Kilerd committed Dec 18, 2024
1 parent 16038fb commit f4f6796
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions test-feature-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,27 @@
import sys


features = ["openapi", "prometheus", "cors"]
import re

# Load features from Cargo.toml
def load_features():
features = []
with open("gotcha/Cargo.toml", "r") as f:
cargo_toml = f.read()

# Extract features from [features] section
in_features = False
for line in cargo_toml.split('\n'):
if line.startswith('[features]'):
in_features = True
continue
elif line.startswith('['):
in_features = False
elif in_features and '=' in line:
feature = line.split('=')[0].strip()
if feature != 'default':
features.append(feature)
return features

def generate_combinations(features):
n = len(features)
Expand All @@ -20,10 +40,8 @@ def generate_combinations(features):
combinations.append(" ".join(combo))

return combinations

# Get combinations
combinations = generate_combinations(features)

combinations = generate_combinations(load_features())
# Print combination matrix
print("Feature Combinations:")
for combo in combinations:
Expand Down

0 comments on commit f4f6796

Please sign in to comment.