GithubHelp home page GithubHelp logo

Tests unittest vs py.test about pydruid HOT 5 CLOSED

druid-io avatar druid-io commented on July 21, 2024
Tests unittest vs py.test

from pydruid.

Comments (5)

xvrl avatar xvrl commented on July 21, 2024

@se7entyse7en I believe py.test requires a lot less work to write tests than unittest, although that may have changed with unittest2 now being part of Python 2.7. I say we stick with py.test unless there is a good reason to change?

from pydruid.

se7entyse7en avatar se7entyse7en commented on July 21, 2024

I'm not an expert about the various python testing tools, but I don't see great advantages that would let me choose py.test over the standard library unittest, but maybe just because I never used it. I took a very fast look at some other python projects to see which testing tools they use and I saw that actually projects such as flask and requests use pytest with requests using unittest and pytest for only some features. On the other hand django uses unittest. So I'm okay in using py.test.

from pydruid.

se7entyse7en avatar se7entyse7en commented on July 21, 2024

@xvrl I found pytest-cov and I think it could be very usefull when writing tests in order to maximize the coverage of the project. Usage:

(pydruid)se7entyse7en@Marvins-MacBook-Air:~/Projects/pydruid (filtered_aggregation)$ py.test --cov-report term-missing --cov pydruid tests/
==============================================================================     test session starts     ===============================================================================
platform darwin -- Python 2.7.6 -- py-1.4.30 -- pytest-2.7.2
rootdir: /Users/se7entyse7en/Projects/pydruid, inifile: 
plugins: cov
collected 10 items 

tests/test_client.py ...s
tests/utils/test_aggregators.py ....
tests/utils/test_query_utils.py ..
---------------------------------------------------------------- coverage: platform darwin, python 2.7.6-final-0 -----------------------------------------------------------------
Name                           Stmts   Miss  Cover   Missing
------------------------------------------------------------
pydruid/__init__                   0      0   100%   
pydruid/client                   162     91    44%   112-140, 143-147, 182, 190-198, 208-209, 212-216, 251-272, 310, 365-373, 412-419, 470-478, 516-520, 546-550, 589-596
pydruid/utils/__init__             0      0   100%   
pydruid/utils/aggregators         23      0   100%   
pydruid/utils/filters             30     11    63%   30-42, 46, 49, 53, 57
pydruid/utils/having              42     20    52%   30-42, 46, 50-57, 61, 64, 67, 79, 82
pydruid/utils/postaggregator      34      9    74%   29, 33, 37, 45, 70-76
pydruid/utils/query_utils         21      1    95%   37
------------------------------------------------------------
TOTAL                            312    132    58%   

====================================================================== 9 passed, 1 skipped in 0.13 seconds     =======================================================================

We could also integrate tox in order to run tests for the different python versions and test pep8 compliancy.

from pydruid.

xvrl avatar xvrl commented on July 21, 2024

@se7entyse7en python test coverage sounds great! We could add a travis integration to get coverage stats like we do for https://github.com/druid-io/druid

from pydruid.

se7entyse7en avatar se7entyse7en commented on July 21, 2024

@xvrl I opened the pull-request #34 starting from pull-request #32 that contains a very basic configuration for travis CI.

from pydruid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.