djui / alias-tips

An oh-my-zsh plugin to help remembering those aliases you defined once
786 stars 50 forks source link

Use nosetests and a data driven test approach #13

Closed pradyunsg closed 8 years ago

pradyunsg commented 8 years ago

I was looking at the test code and there's a lot of repetition. Consider using some sort of data-driven testing. It'll make the tests easier to write and work with.

Suggestions:

pradyunsg commented 8 years ago

Just edited the OP.

djui commented 8 years ago

Thanks for the idea. I would like to keep the verbose style and not switch to Table-driven (Data-driven) testing so I can create classes and let the test function name document test outputs and more granularity on which test case failed which should give me easier understanding when trying to fix it.

Please let me know if you have ideas on how to combine test classes and test function names and table driven testing, then I can reopen the issue again.

pradyunsg commented 8 years ago

Well, in the first linked decorator, you can do so... Put a description associated with every data-point. See this for the output of the test running setup I used for that repo.

Check out https://github.com/pradyunsg/Py2C/blob/f907f977c845a0bb09915ab3d12854666582e1e0/py2c/tree/tests/data/node-assignment.yaml (and any other yaml file) in the same repo as an example.

I should release that as a separate package but I'm without a dev-machine at hand...

(edited)

pradyunsg commented 8 years ago

Would you mind if I made a PR demonstrating this?

djui commented 8 years ago

Yes, please.

pradyunsg commented 8 years ago

I'll do so, after I fix the new testing-package I'm writing or once ddt accepts my PR or I decide to ditch them both and write something for this package.

Basically, latest by tomorrow.

pradyunsg commented 8 years ago

Ah. Tomorrow never came. I got carried away with ddt and ended up rewriting that package. I apologize for that.

I'm now taking on an issue over a pypa/pip. I won't be able to bother you with the PR just yet. Rest assured I will eventually though. :wink:

I hope to write the PR for this after I get my work into ddt upstream which would be after this pip issue. Sorry but this just got pushed to the back-burner.

djui commented 8 years ago

Thanks for the heads up and update, and definitely no worries.