marl / jams

A JSON Annotated Music Specification for Reproducible MIR Research
ISC License
186 stars 27 forks source link

Unit test error for schema_test.py #103

Closed justinsalamon closed 8 years ago

justinsalamon commented 8 years ago

I just pulled the latest&greatest and ran the unit tests (from the tests folder) before getting started on my transcription wrapper, but one test is failing and I'm not entirely clear on what's going on:

ERROR: Failure: KeyError ('jams/tests/fixtures/schema')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nose/loader.py", line 251, in generate
    for test in g():
  File "/Users/justin/Documents/dev/jams/jams/tests/schema_test.py", line 64, in test_schema_local
    'schema'))
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 954, in resource_filename
    self, resource_name
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 1652, in get_resource_filename
    return self._extract_resource(manager, zip_path)
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 1673, in _extract_resource
    timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
KeyError: 'jams/tests/fixtures/schema'

----------------------------------------------------------------------

@bmcfee Any chance you can help a brother out?

bmcfee commented 8 years ago

This is an artifact of nesting the tests/ directory under the package rather than at the top-level.

Does it work if you run it from the top level dir in the repo as:

$ nosetests -w jams/tests
justinsalamon commented 8 years ago

afraid not, still getting same error.

justinsalamon commented 8 years ago

Could it be that it's trying to load tests from tests/fixtures/schema/testing_uppercase.json, even though there aren't any?

bmcfee commented 8 years ago

That's strange, since it shouldn't be loading any of the test data through pkg_resources.

Are you sure that things are installed properly (ie, pip install -e . from the tld)?

justinsalamon commented 8 years ago

That seems to have done the trick (even though all the requirements were already satisfied). Could it be because I hadn't run setup.py develop (which pip seems to have)?

bmcfee commented 8 years ago

Yup. For future reference, pip install -e . will install the package locally without copying. This way, any changes you make in the repo are immediately importable. This is good for testing (compared to not installing at all) because it more accurately reflects how it will be used in the wild.

This is also why it's handy to use conda environments to distinguish between "stable" and "development" environments.

justinsalamon commented 8 years ago

roger that, cheers.