Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Conversation

sc932
Copy link
Contributor

@sc932 sc932 commented Oct 7, 2014

********* PEOPLE *************
Primary reviewer: @suntzu86

Reviewers:

********* DESCRIPTION **************
Branch Name: sclark_36_testify_to_pytest
Ticket(s)/Issue(s): Closes #36

-transitioned from testify to pytest, nothing fancy yet.
-single fcn vs class setup/teardown being handled properly
-fixed some scoping issues with instance v class v static methods
-applied hidetraceback where appropriate

-future cleanup/pytest improvements (it's a lot more powerful than testify!) to be tracked in #408

********* TESTING DONE *************
make test
make style-test

@suntzu86
Copy link
Contributor

suntzu86 commented Oct 7, 2014

haven't gone through the code, but could we get something like:
http://pytest.org/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option
or
http://pytest.org/latest/skipping.html
for marking tests as 'exclude'? Before this was straightforward in testify but would not be now. Marking 'slow' is an interesting idea too.

Also we may want our test helper functions (like relative error checks) to do something more like:
http://pytest.org/latest/example/simple.html#writing-well-integrated-assertion-helpers
i.e., add the tracebackhide thing.

@sc932
Copy link
Contributor Author

sc932 commented Oct 8, 2014

Yes, we can do all sorts of cool things with this framework.

If you want anything in particular feel free to ticket it. This is just the 0 level switch over to the new system. From here we can optimize.

@suntzu86
Copy link
Contributor

Added a tracking tickets for more pytest improvements:
#408

couple of things:

  1. the tracebackhide is generally useful and a one-liner so I'm adding those
  2. pytest.fixture's default scope is "function". for things that were previously class_setup, they should be "class" (and in the future some of these should be module or even session)
  3. making a "fin" function doesn't cause cleanup to happen nor does the name matter. You have to register it in a request object:
@pytest.fixture(autouse=True)
def myfixture(request):
  ...stuff...
  def finalize():
    ...cleanup...
  request.addfinalizer(finalize)

I'm making these changes now and will commit a diff to this branch.

scoping/calling logging hiding fixtures correctly
…tup/teardown should've all

 been @classmethod. py.test doesn't even work without this setting (and it was very very fragile before)
-fixing function scoping issues in general (classmethod/staticmethod where appropriate)
@suntzu86
Copy link
Contributor

cleaned some stuff up, shipit from me

@sc932
Copy link
Contributor Author

sc932 commented Oct 15, 2014

🐑 it

Thanks @suntzu86!

suntzu86 added a commit that referenced this pull request Oct 15, 2014
@suntzu86 suntzu86 merged commit fd71593 into master Oct 15, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port testing from testify to py.tests
2 participants