Added more tests including network tests

I added more test methods, including testing the face registration and interest methods. I used the gevent library (http://www.gevent.org) to run threads with two faces on localhost.

Ok. Just couldn't tell. :)   Yes, the test cases are run automatically.

Adeola, it helps that they can be run from the command line, so either this or the simpler ut.main() should be left in.

I have another question for later about when gevent.sleep(0.01) vs. gevent.sleep(), which should just yield (in the java sense)...


From: Alex Afanasyev <notifications@github.com<mailto:notifications@github.com>>
Reply-To: named-data/PyNDN2 <reply@reply.github.com<mailto:reply@reply.github.com>>
Date: Mon, 16 Jun 2014 12:53:58 -0700
To: named-data/PyNDN2 <PyNDN2@noreply.github.com<mailto:PyNDN2@noreply.github.com>>
Cc: Jeff Burke <jburke@remap.ucla.edu<mailto:jburke@remap.ucla.edu>>
Subject: Re: [PyNDN2] Added more tests including network tests (#2)


In tests/unit_tests/test_face_methods.py:

> +    def face_process_events(self, face, callbacks, name=None):
> +        # implemented as a 'greenlet': something like a thread, but semi-synchronous
> +        # callbacks should be a list
> +        done = False
> +        while not done:
> +            face.processEvents()
> +            gevent.sleep(0.01)
> +            for c in callbacks:
> +
> +                if (c.call_count > 0):
> +                    done = True
> +
> +
> +
> +if __name__ == '__main__':
> +    suite = ut.TestLoader().loadTestsFromTestCase(TestFaceInterestMethods)


It's not that it bothers me, I just don't know exactly what it is doing. I think the test cases should be run automatically by python (or nosetests wrapper), using which one would specify the desired tests and verbosity... Unless I'm missing something

—
Reply to this email directly or view it on GitHub<https://github.com/named-data/PyNDN2/pull/2/files#r13826777>.