1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
@issue
Feature: Issue #184: TypeError when running behave with --include option
. Running behave with option '--include' causes fail with following error:
.
. Traceback (most recent call last):
. File "/.../bin/behave", line 8, in
. load_entry_point('behave==1.2.3', 'console_scripts', 'behave')()
. File "/.../lib/python2.7/site-packages/behave/__main__.py", line 111, in main
. ...
. File "/.../lib/python2.7/site-packages/behave/runner.py", line 490, in run_with_paths
. if not self.config.exclude(filename) ]
. File "/.../lib/python2.7/site-packages/behave/configuration.py", line 488, in exclude
. if self.include_re and self.include_re.search(filename) is None:
. TypeError: expected string or buffer
.
. RELATED:
. * features/runner.select_files_by_regexp.feature
. * features/runner.select_files_by_regexp2.feature
@setup
Scenario: Feature Setup
Given a new working directory
And a file named "features/steps/passing_steps.py" with:
"""
from behave import step
@step('{word:w} step passes')
def step_passes(context, word):
pass
"""
And a file named "features/alice.feature" with:
"""
Feature: Alice
Scenario: A1
Given a step passes
"""
And a file named "features/bob.feature" with:
"""
Feature: Bob
Scenario: B1
When another step passes
Scenario: B2
Then another step passes
"""
Scenario: Use --include command-line option to select some features
When I run "behave -f plain --include='features/a.*\.feature'"
Then it should pass with:
"""
1 feature passed, 0 failed, 0 skipped
1 scenario passed, 0 failed, 0 skipped
"""
And the command output should contain:
"""
Feature: Alice
"""
But the command output should not contain:
"""
Feature: Bob
"""
Scenario: Use --include command-line option to select all features
When I run "behave -f plain --include='.*\.feature'"
Then it should pass with:
"""
2 features passed, 0 failed, 0 skipped
3 scenarios passed, 0 failed, 0 skipped
"""
Scenario: Use --exclude command-line option
When I run "behave -f plain --exclude='features/a.*\.feature'"
Then it should pass with:
"""
1 feature passed, 0 failed, 0 skipped
2 scenarios passed, 0 failed, 0 skipped
"""
And the command output should contain:
"""
Feature: Bob
"""
But the command output should not contain:
"""
Feature: Alice
"""
Scenario: Use --include and --exclude command-line options
When I run "behave -f plain --include='.*\.feature' --exclude='features/a.*\.feature'"
Then it should pass with:
"""
1 feature passed, 0 failed, 0 skipped
2 scenarios passed, 0 failed, 0 skipped
"""
And the command output should contain:
"""
Feature: Bob
"""
But the command output should not contain:
"""
Feature: Alice
"""
Scenario: Use --include command-line option with file location
When I run "behave -f plain --include='features/a.*\.feature' features/alice.feature:3"
Then it should pass with:
"""
1 feature passed, 0 failed, 0 skipped
1 scenario passed, 0 failed, 0 skipped
"""
And the command output should contain:
"""
Feature: Alice
"""
But the command output should not contain:
"""
Feature: Bob
"""
Scenario: Use --exclude command-line option with feature list file
Given a file named "selected.txt" with:
"""
# -- FEATURE-LIST FILE:
features/alice.feature:3
features/bob.feature:7
"""
When I run "behave -f plain --no-skipped --exclude='.*/a.*\.feature' @selected.txt"
Then it should pass with:
"""
1 feature passed, 0 failed, 0 skipped
1 scenario passed, 0 failed, 1 skipped
"""
And the command output should contain:
"""
Feature: Bob
Scenario: B2
"""
But the command output should not contain:
"""
Feature: Alice
"""
|