jpmckinney / validictory

🎓 deprecated general purpose python data validator
Other
240 stars 57 forks source link

explicit format fields for compatibility with python2.6 / added min/maxProperties #102

Closed Heiko-san closed 8 years ago

Heiko-san commented 8 years ago

Since this is kind of a "low hanging fruit" I decided to fix this, maybe you want to merge it :)

I successfully testet the named format strings and some occurrences of {0!r} for compatibility with python2.6

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 96.419% when pulling dc9fc4cddfb68a3f23fe73802bda29ac860268f1 on Heiko-san:master into 4ef2294c1d37088c5aa1579167e710676c8af134 on jamesturk:master.

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.5%) to 95.957% when pulling 98b5f7e74dc778fa44e2496928af9991486a3b54 on Heiko-san:master into 4ef2294c1d37088c5aa1579167e710676c8af134 on jamesturk:master.

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.5%) to 95.957% when pulling 98b5f7e74dc778fa44e2496928af9991486a3b54 on Heiko-san:master into 4ef2294c1d37088c5aa1579167e710676c8af134 on jamesturk:master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.08%) to 96.496% when pulling e6e128b11adf1901c733a78bc209c1e9ae8d9790 on Heiko-san:master into 4ef2294c1d37088c5aa1579167e710676c8af134 on jamesturk:master.

Heiko-san commented 8 years ago

Hmm, I don't get coveralls :/ What tests does it think are still missing? I had a look at your tests for min/maxLength and build the same, but still it complains Coverage decreased (-0.5%) to 95.957% when pulling e6e128b

jamesturk commented 8 years ago

I wouldn't worry about the 0.5% decrease, I'll find some time fairly soon to look over these PRs, thanks!

Heiko-san commented 8 years ago

No problem , these were actually easy and not too time consuming. Maybe I'll analyse my bug issue at weekend ^^ Btw: this module is really great work!

jamesturk commented 8 years ago

with this change do all the tests pass on 2.6? I'm torn about supporting it at all, but if it is such a simple change and that's all I'm open to it

Heiko-san commented 8 years ago

Well ... actually I had a lot of trouble getting the unittests itself to run, but they succeed (2.6 unittests don't seem to have a discovery feature):

[root@653cf5249e9e tests]# pwd
/opt/monitoring/pythonlibs/validictory/tests
[root@653cf5249e9e tests]# python --version
Python 2.6.6
[root@653cf5249e9e tests]# for i in $(ls | grep test_ | grep -v '.pyc$'); do echo $i ; PYTHONPATH=../../ python ./$i ; done
test_apply_default.py
...
----------------------------------------------------------------------
Ran 3 tests in 0.000s

OK
test_disallow_unknown_properties.py
....
----------------------------------------------------------------------
Ran 4 tests in 0.001s

OK
test_fail_fast.py
.....
----------------------------------------------------------------------
Ran 5 tests in 0.007s

OK
test_items.py
............
----------------------------------------------------------------------
Ran 12 tests in 0.004s

OK
test_other.py
......
----------------------------------------------------------------------
Ran 6 tests in 0.001s

OK
test_properties.py
...................
----------------------------------------------------------------------
Ran 19 tests in 0.006s

OK
test_remove_unknown_properties.py
...
----------------------------------------------------------------------
Ran 3 tests in 0.001s

OK
test_schema_schema.py
.
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK
test_type.py
...........................
----------------------------------------------------------------------
Ran 27 tests in 0.012s

OK
test_values.py
............................................................
----------------------------------------------------------------------
Ran 60 tests in 0.016s

OK
[root@653cf5249e9e tests]# 

Had to add the following to each test file for it to run with the above command:


if __name__ == '__main__':
        import unittest
        unittest.main()

But actually I think there is no need to officially support python2.6, but would be a nice to have to provide the explicit format fields so it will actually run on python2.6 (if officially supported or not).

Heiko-san commented 8 years ago

Hi,

any new status here?

jamesturk commented 8 years ago

sorry, didn't realize this had the min/max properties stuff on the same branch, thanks!