IOMirea / jarpc

Just another RPC library
https://jarpc.readthedocs.io
GNU General Public License v3.0
5 stars 2 forks source link

Tests #7

Open Fogapod opened 5 years ago

Fogapod commented 5 years ago

Tests using mock, maybe tests involving real redis in travis, coverage

suv27 commented 5 years ago

Can you assign this issue to me, I just started working on it and would like to contribute and start the unit tests and set up everything correctly

Fogapod commented 5 years ago

Alright, it would be very helpful if you could do this

Fogapod commented 5 years ago

I apoligize for the inconveniences, but several breaking changes had to be made. All changes are reflected in existing examples. Changes:

suv27 commented 5 years ago

Were these changes made already? are they made into the master branch, if they are I can definitely pull and it shouldn't be a problem.

I am currently working on getting everything set up, the coverage page for the test and all the .py files. and then starting to unit test one by one python file.

Fogapod commented 5 years ago

Yes, they are in master

suv27 commented 5 years ago

I am having some issue working with Travis CI since is my first time, I am getting an error for in the virtualenv for Travis that is not recognizing one of my import. Maybe you can provide me some help or guidelines if you have seen this before, if not I will keep debugging

___________ ERROR collecting tests/unit/enums_py/StatusCode_test.py ____________ ImportError while importing test module '/home/travis/build/IOMirea/yarpc/tests/unit/enums_py/StatusCode_test.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/unit/enums_py/StatusCode_test.py:3: in <module> from iomirea_rpc import enums E ModuleNotFoundError: No module named 'iomirea_rpc'

Fogapod commented 5 years ago

Sorry for that, library was renamed to yarpc recently

suv27 commented 5 years ago

No worries I restarted and using pytests as you want it

suv27 commented 5 years ago

Hey @Fogapod, let me know if you feel this my PR #22 is missing anything to resolve thIS issue.

Fogapod commented 5 years ago

@Physsix27 are you going to write tests or you only wanted to configure make, Travis?

suv27 commented 5 years ago

Yes I want to continue writing tests but right now I am not going to be able to bring the project to 100% coverage, I can just write test for some python files. I can write tests for request.py, reponse.py and abc.py and bring those 3 files up to 100% coverage. This is how they are currently looking: image

suv27 commented 5 years ago

I will work on the tests later today for the files I mentioned above

Gelbpunkt commented 5 years ago

I'd suggest testing against a real redis install via docker in Travis.

suv27 commented 5 years ago

@Gelbpunkt Can I get a little more detail about that and what is that since I have never done that?

Gelbpunkt commented 5 years ago

@Fogapod does not like my idea, I think. Docker is a container daemon that runs on almost all platforms. It runs stuff mostly isolated from your OS. You can for example run Ubuntu or Alpine Linux in a container on a Mac. Inside a container, you can have an image. Those can be a basic OS or even contain software, for example Redis.

https://hub.docker.com/_/redis

You'd run docker pull redis:5.0.6-alpine to pull the image to your PC (using Alpine Linux has smaller images usually). Then you can run it and map the port inside the container to your PC. docker run --rm -d --name redis -p 6739:6739 redis:5.0.6-alpine This will start a container in the background which runs Redis on the container, mapping the port to your PC.

You can then use redis-cli on your machine to connect to the redis in the container.

Containers are platform-independent (mostly), usually very up to date, depending on the image, and extremely secure due to being mostly separate from the host.

Hope that helps ;)

suv27 commented 5 years ago

I don't understand what you want me to do, which looks like a different issue which I don't understand much and would have to do some research to learn more about that topic. I want it to do more python tests because that is the skill I am currently trying to improve. but what you are explaining seems a little different and does not specifies what is it that I need to test. Testing against a real redis I am not sure what that means. @Gelbpunkt

Gelbpunkt commented 5 years ago

I meant that we should maybe think about not using mocks but instead using a Redis with client and server to test them

suv27 commented 5 years ago

@Gelbpunkt I understand what you are trying to say but you still need to test the python code of the project as well no matter which path you take, that would be a decision of the project owner to take. What would be its advantage and disadvantages with going with one or another

Fogapod commented 5 years ago

@Physsix27 Is there any more progress on this? I should inform you that project was renamed from yarpc to jarpc. I hope this won't happen anymore