meejah / txtorcon

Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/
MIT License
250 stars 72 forks source link

Consider using py.test #136

Open meejah opened 9 years ago

meejah commented 9 years ago

I believe the test-suite could be made more clear and shrink a little if using py.test. In any case, I prefer the py.test style and it saves an indent-level.

So, tests would look like:

def test_something(fixture0, fixture1):
    assert False, "It failed"

Anything in a setUp method would be converted to an @pytest.fixture and in some cases paramtrization could be used to good effect.

(This is al low-priority thing, but anyone interested in Twisted, py.test and Tor might like to tackle it).

decentral1se commented 7 years ago

@meejah, any ongoing work on this? I'd like to take a stab at it. I saw #158 got closed off.

meejah commented 7 years ago

Hi @lwm there hasn't been any more work on this, no. The tests in #158 are pretty basic ...

One thing that would be great to get out of a refactor to py.test would be to use Twisted's semi-official IOPump to do any of the tests that "fake out" network data from Tor. I haven't thought too hard about this, but ideally a @pytest.fixture would capture most of these use-cases somehow.

Beware that I've got a ton of refactoring, a few API changes and a couple new APIs (and basically a complete re-write of docs) in the release-1.x branch which I hope to make into master "soon".

decentral1se commented 7 years ago

Beware that I've got a ton of refactoring

Ah, I reviewed the release-1.x diff and it's pretty big. I think I'll just wait for 1.x to arrive. I'll watch the repo and poke my head back when things are more stable. Kudos for the work.

meejah commented 7 years ago

Yeah it's big :/

I will probably merge some of the "completely new" features into 0.x (since they don't change/break any APIs). I would appreciate feedback on the txtorcon.Tor object (in controller.py) -- specifically, whether you think this is an intuitive API.

decentral1se commented 7 years ago

I would appreciate feedback on the txtorcon.Tor

I've had a look but I'm not really in a position to give any useful feedback. Sorry,

Good luck with the upcoming release!

meejah commented 6 years ago

"Tor" etc have been merged to master