simphony / simphony-metadata

[LEGACY] This repository contains the metadata definitions used in SimPhoNy project.
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Add lammps keys #22

Closed mehdisadeghi closed 8 years ago

mehdisadeghi commented 8 years ago

This PR adds some CUBA keys used in simphony-lammps-md project.

@ahashibon @TobiasRasp Please comment.

@kitchoi @tuopuu How do you find the structure of the BOX, specially the default field? I tried to dump the value of another structure as value for the default field.

tuopuu commented 8 years ago

I think @kitchoi is making a good point there in the line comments: We should try to use existing CUBA as much as it's possible, and avoid adding many similar keys in the list.

ahashibon commented 8 years ago

I think @kitchoi is making a good point there in the line comments: We should try to use existing CUBA as much as it's possible, and avoid adding many similar keys in the list.

agree as long as the already existing CUBA make sense, and are used already deeply!

mehdisadeghi commented 8 years ago

@kitchoi @ahashibon This PR is finally passes the test. I had a problem with default value for BASIS.VECTOR and I had to put shape = (3, 3) to get rid of it.

codecov-io commented 8 years ago

Current coverage is 94.82%

Merging #22 into master will increase coverage by 0.28%

@@             master        #22   diff @@
==========================================
  Files             2          2          
  Lines           220        232    +12   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            208        220    +12   
  Misses           12         12          
  Partials          0          0          

Powered by Codecov. Last updated by 787d50e...950c274

kitchoi commented 8 years ago

@mehdisadeghi Can you update your local master branch, merge master to this branch and then push your changes here please?

mehdisadeghi commented 8 years ago

@kitchoi There are no new changes in master to be merged with this branch. Is there anything specific to be merged?

kitchoi commented 8 years ago

@mehdisadeghi I just thought that might be why travis ci test for PR was failing...maybe not then.

mehdisadeghi commented 8 years ago

@kitchoi Would you mind checking the error message more in detail? I just tried running tests in CI container and realized that in the case of the failing test, most probably, the mock patch is not applied.

kitchoi commented 8 years ago

@mehdisadeghi Ok, I am looking into it.

kitchoi commented 8 years ago

@mehdisadeghi I ran the tests with the travis docker image too and I could not reproduce the errors. Could you reproduce it? If so, you may be at a better position than me for hunting down the source of errors.

kitchoi commented 8 years ago

Turns out test failure is caused by the different order of tests run in travis-ci/pr and travis-ci/push. The errors are reproducible by running this:


$ python -m unittest discover -v -p test_v*
test_check_shape_simple (simphony_metadata.scripts.tests.test_validation.TestValidation) ... ok
test_check_shape_special (simphony_metadata.scripts.tests.test_validation.TestValidation)
Test for value=1 and value=[1] to be both valid for shape=(1) ... ok
test_decode_shape (simphony_metadata.scripts.tests.test_validation.TestValidation) ... ok
test_error_check_shape (simphony_metadata.scripts.tests.test_validation.TestValidation)
Test for ValueError for invalid shapes ... ok
test_error_validate_cuba_keyword (simphony_metadata.scripts.tests.test_validation.TestValidation)
Test for TypeError for invalid CUBA keyword value ... ERROR
test_validate_cuba_keyword (simphony_metadata.scripts.tests.test_validation.TestValidation)
Test for valid cases for CUBA keyword values ... simphony_metadata/scripts/tests/meta_class/validation.py:166: UserWarning: Value is a string, its shape is not validated. Please fix the cuba.yml shape syntax.
  warnings.warn('Value is a string, its shape is not validated. '
ok

======================================================================
ERROR: test_error_validate_cuba_keyword (simphony_metadata.scripts.tests.test_validation.TestValidation)
Test for TypeError for invalid CUBA keyword value
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "simphony_metadata/scripts/tests/test_validation.py", line 99, in test_error_validate_cuba_keyword
    type=KEYWORDS[cuba_name.upper()].dtype,
KeyError: 'CUBA.MATERIAL'

----------------------------------------------------------------------
Ran 6 tests in 0.004s

FAILED (errors=1)

The patch magic in test_validation has not worked and probably only had worked relying on imports from another test module.

mehdisadeghi commented 8 years ago

@kitchoi Your patch fixed the error! However I am adding more commits to this PR and then it is ready to be merged.