alexcouper / captainhook

Git hook scripts
BSD 3-Clause "New" or "Revised" License
54 stars 14 forks source link

Fix behavioral tests #47

Closed koddsson closed 10 years ago

koddsson commented 10 years ago

I seem to have some trouble running the behavioral tests

λ bubblegum captainhook → λ git master* → lettuce features

Feature: pdb checker                                                                 # features/pdb_checker.feature:1

  Background:
Died with The step r"Given that I am in a git repository" is not defined
Traceback (most recent call last):
  File "/home/koddsson/.virtualenvs/captainhook/local/lib/python2.7/site-packages/lettuce/__init__.py", line 164, in run
    failfast=self.failfast))
  File "/home/koddsson/.virtualenvs/captainhook/local/lib/python2.7/site-packages/lettuce/core.py", line 1186, in run
    scenarios_ran.extend(scenario.run(ignore_case, failfast=failfast))
  File "/home/koddsson/.virtualenvs/captainhook/local/lib/python2.7/site-packages/lettuce/core.py", line 726, in run
    results.append(run_scenario(self, run_callbacks=True))
  File "/home/koddsson/.virtualenvs/captainhook/local/lib/python2.7/site-packages/lettuce/core.py", line 697, in run_scenario
    self.background.run(ignore_case)
  File "/home/koddsson/.virtualenvs/captainhook/local/lib/python2.7/site-packages/lettuce/core.py", line 858, in run
    matched, step_definition = step.pre_run(ignore_case)
  File "/home/koddsson/.virtualenvs/captainhook/local/lib/python2.7/site-packages/lettuce/core.py", line 355, in pre_run
    raise NoDefinitionFound(self)
NoDefinitionFound: The step r"Given that I am in a git repository" is not defined

0 feature (0 passed)
0 scenario (0 passed)
0 step (0 passed)
λ bubblegum captainhook → λ git master* → 
alexcouper commented 10 years ago

What happens if you run them with behave?

koddsson commented 10 years ago

Oh then they run :) Although I'm getting failures then

λ bubblegum captainhook → λ git master* → behave  
Feature: pdb checker # features/pdb_checker.feature:1

  Background:   # features/pdb_checker.feature:3

  Scenario: When enabled, the pdb checker raises an error with pdb statements        # features/pdb_checker.feature:7
    Given that I am in a git repository                                              # ../../home/koddsson/Repos/captainhook/features/steps/git_steps.py:7 0.006s
    And I have installed captainhook                                                 # ../../home/koddsson/Repos/captainhook/features/steps/install_steps.py:6 0.074s
    When I create a file called "pdb_fail.py" containing a pdb.set_trace() statement # ../../home/koddsson/Repos/captainhook/features/steps/file_steps.py:4 0.000s
    And I git add "pdb_fail.py"                                                      # ../../home/koddsson/Repos/captainhook/features/steps/git_steps.py:12 0.005s
    And I attempt to commit                                                          # ../../home/koddsson/Repos/captainhook/features/steps/git_steps.py:17 0.006s
    Then I see an error                                                              # ../../home/koddsson/Repos/captainhook/features/steps/output_steps.py:5 0.000s
      Assertion Failed: '' == ''

    And there are uncommitted changes                                                # None

Feature: pdb checker # features/python3.feature:1

  Background:   # features/python3.feature:3

  Scenario: When enabled, the py3 checker raises an error with non py3 syntax  # features/python3.feature:7
    Given that I am in a git repository                                        # ../../home/koddsson/Repos/captainhook/features/steps/git_steps.py:7 0.005s
    And I have installed captainhook                                           # ../../home/koddsson/Repos/captainhook/features/steps/install_steps.py:6 0.076s
    When I create a file called "py_fail.py" containing a print statement      # ../../home/koddsson/Repos/captainhook/features/steps/file_steps.py:11 0.000s
    And I git add "py_fail.py"                                                 # ../../home/koddsson/Repos/captainhook/features/steps/git_steps.py:12 0.006s
    And I attempt to commit                                                    # ../../home/koddsson/Repos/captainhook/features/steps/git_steps.py:17 0.007s
    Then I see an error                                                        # ../../home/koddsson/Repos/captainhook/features/steps/output_steps.py:5 0.000s
      Assertion Failed: '' == ''

    And there are uncommitted changes                                          # None

Failing scenarios:
  features/pdb_checker.feature:7  When enabled, the pdb checker raises an error with pdb statements
  features/python3.feature:7  When enabled, the py3 checker raises an error with non py3 syntax

0 features passed, 2 failed, 0 skipped
0 scenarios passed, 2 failed, 0 skipped
10 steps passed, 2 failed, 2 skipped, 0 undefined
Took 0m0.187s
alexcouper commented 10 years ago

Ill need to add some more output on failure in order to know why it's not working for you.

My two suspicions are:

Could you run: pip install -e . And try again?

koddsson commented 10 years ago

So I checked that tox.ini has all the checkers enabled and installed captainhook again and no change :/

koddsson commented 10 years ago

This turned out to be a issue with my environment.