Skip to content

RousseauLambertLP/wmo-cmp-ts

 
 

Repository files navigation

Build Status

WMO Core Metadata Profile Test Suite

This library implements validation against WMO Core Metadata Profile 1.3, specifically Part 2, Section 2.

Installation

virtualenv wmo-cmp-ts
cd wmo-cmp-ts
. bin/activate
git clone [email protected]:OGCMetOceanDWG/wmo-cmp-ts.git
cd wmo-cmp-ts
pip install -r requirements.txt
python setup.py build
python setup.py install

Running

From command line:

wmo-metadata-validate.py /path/to/file.xml

Using the API

# test a file on disk
>>> from lxml import etree
>>> from wmo_cmp_ts import test_suite
>>> exml = etree.parse('/path/to/file.xml')
>>> ts = test_suite.WMOCoreMetadataProfileTestSuite13(exml)
>>> ts.run_tests()  # raises ValueError error stack on exception
# test a URL
>>> from urllib2 import urlopen
>>> from StringIO import StringIO
>>> content = StringIO(urlopen('http://....').read())
>>> exml = etree.parse(content)
>>> ts = test_suite.WMOCoreMetadataProfileTestSuite13(exml)
>>> ts.run_tests()  # raises ValueError error stack on exception
# handle test_suite.TestSuiteError
# test_suite.TestSuiteError.errors is a list of errors
>>> try:
...    ts.run_tests()
... except test_suite.TestSuiteError as err:
...    print(err.message)
...    '\n'.join(err.errors)
>>> ...

Development

virtualenv wmo-cmp-ts
cd wmo-cmp-ts
source bin/activate
git clone [email protected]:OGCMetOceanDWG/wmo-cmp-ts.git

Running tests

# via distutils
python setup.py test
# manually
python tests/run_tests.py

Code Conventions

wmo-cmp-ts code conventions are as per PEP8

Issues

Issues are managed at https://github.com/OGCMetOceanDWG/wmo-cmp-ts/issues

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%