heynemann / pyvows

Python implementation of Vows.js

Home Page:http://pyvows.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@focus decorator

heynemann opened this issue · comments

Create a context decorator called focus. This would tell pyVows that it only needs to run the specified context. This is very useful when trying to fix a specific context.

Of course all the parent contexts need to be run as well.

Would be something like:

class SomeContext(Vows.Context):
    def topic(self):
        return 42

    class SomeChildContext(Vows.Context):
        def should_be_42(self, topic):
            expect(topic).to_equal(42)        

    @focus
    class OtherChildContext(Vows.Context):
        def should_be_42(self, topic):
            expect(topic).to_equal(42)        

In the above example, both SomeContext and OtherChildContext should be run, but not SomeChildContext.

See also #22.

Note that this is not the same as running a single vow from the command line. I'd even say that if this is implemented we don't need to run a single vow from the command line.

Does having the decorator make implementing the commandline argument easier? If I had to pick one, I'd prefer to have the commandline argument, however best would be to have both.

Could the commandine argument apply the focus decorator at run time?