behave-subdirectory-loading

Configure behave to recursively load step definitions from subdirectories via pkgutil.

3|Updated Dec 14, 2025
One-click install
npx skills add https://github.com/plocher/jBOM --skill behave-subdirectory-loading
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: behave-subdirectory-loading
Source: https://github.com/plocher/jBOM/tree/main/.agents/skills/behave-subdirectory-loading
Command: npx skills add https://github.com/plocher/jBOM --skill behave-subdirectory-loading

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill resolves the limitation where the behave testing framework fails to automatically discover and load step definitions organized into domain-specific subdirectories, preventing Undefined step errors.

Core Features & Use Cases

  • Dynamic Step Discovery: Implements a robust import shim that recursively loads step definitions from nested directory structures.
  • Modular Organization: Allows developers to group test steps by domain, such as BOM generation or error handling, improving maintainability in large feature suites.
  • Use Case: When a project grows beyond a flat steps directory, this skill provides the necessary Python package configuration and dynamic loader to keep the test suite organized and functional.

Quick Start

Apply the dynamic import shim to the features steps init file to enable automatic loading of all nested step definition modules.

Frequently Asked Questions about behave-subdirectory-loading

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does behave fail to load step definitions from subdirectories?

Behave fails to load step definitions from subdirectories because the standard framework import mechanism does not automatically traverse nested directory structures. It requires a dynamic import shim to recursively load step modules and prevent undefined step errors.

How do I organize behave step definitions into domain-specific subdirectories?

To organize behave step definitions into subdirectories, apply a dynamic import shim using pkgutil to the features steps init file. This configures recursive package traversal, enabling automatic discovery of modular step definitions grouped by domain.

Can I use pkgutil to dynamically load nested behave step modules?

Yes, you can use pkgutil to dynamically load nested behave step modules. By implementing a dynamic import shim in the steps init file, pkgutil recursively traverses Python packages to bypass standard behave import limitations.

What is the best way to modularize a large behave test suite in Python?

The best way to modularize a large behave test suite is grouping feature steps into domain-specific subdirectories. This requires configuring recursive package traversal with a dynamic loader to maintain organization and prevent undefined step errors.

Does this dynamic step discovery approach work with existing Python test suites?

Yes, this dynamic step discovery approach works with existing Python test suites. It targets projects requiring modular organization, allowing developers to integrate hierarchical step definition discovery into their current behave framework setup without external dependencies.