Skip to content

Commit

Permalink
Added failing pytest test as runnable example
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimegildesagredo committed Oct 25, 2018
1 parent cb05031 commit 90eb128
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include *requirements.txt
include README.rst
include LICENSE
recursive-include docs *
recursive-include specs *.py
recursive-include examples *.txt *.py
recursive-include docs *
1 change: 1 addition & 0 deletions examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
7 changes: 7 additions & 0 deletions examples/test_pytest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-

from expects import *


def test_failing():
expect("foo").to(equal("bar"))
4 changes: 4 additions & 0 deletions expects/expectations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ def __init__(self, subject):
@property
def not_to(self):
__tracebackhide__ = True

self._negated = True
return self.to

@property
def to_not(self):
__tracebackhide__ = True

return self.not_to

def to(self, matcher):
__tracebackhide__ = True

self._assert(matcher)

def _assert(self, matcher):
__tracebackhide__ = True

ok, reasons = self._match(matcher)

if not ok:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
author='Jaime Gil de Sagredo Luna',
author_email='jaimegildesagredo@gmail.com',
license='Apache 2.0',
packages=find_packages(exclude=['specs', 'specs.*']),
packages=find_packages(exclude=['specs', 'specs.*', 'examples', 'examples.*']),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
Expand Down

0 comments on commit 90eb128

Please sign in to comment.