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