Skip to content

Test conllu reader and writer in Travis#21

Merged
VincTheSecond merged 8 commits into
masterfrom
pytest
Dec 19, 2016
Merged

Test conllu reader and writer in Travis#21
VincTheSecond merged 8 commits into
masterfrom
pytest

Conversation

@martinpopel

Copy link
Copy Markdown
Contributor

Most of the tests can be unittests, but we need at least few tests,
which run the udapy runner from command line.
I am not sure how to integrate this into pytest, so for now I did it as additonal test in .travis.yml.

The test I added is to check that that by reading and writing a conllu file we don't lose any info.
Currently, Travis CI fails on this test, but that's the purpose of this PR.

python -m py.test does not work in my Python 3.5
trying to fix python3 and failing Travis
`packages=['udapi']` installs just the root udapi package (with no modules).
We need `packages=['udapi', 'udapi.core', 'udapi.block', 'udapi.block.demo',...]`,
but it would be difficult to keep this list updated,
so let's use `find_packages()` helepr function for this purpose.
We just need to have `__init__.py` files in each package,
which we have anyway.
Users must make sure Udapi (with all its packages) is Python's search path.
So either
* installing Udapi from local dir (`python setup.py install --user` or `pip install -e .`), or
* installing Udapi from PyPI (once we upload it there), or
* developers' mode: set PYTHONPATH and PATH as suggested in README.md.
My original motivation for adding `--user` was to prevent the need of `sudo` in Travis.
However, Travis runs Pythons in virtualenv, so this is not needed.
Even worse, it fails with `python setup.py install --user`.
self.file_handler.write('\n')

self.file_handler.write("\n")
if number_of_written_bundles != len(document.bundles) - 1:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to CoNLL-U specification, each tree (including the last one) must end with an empty line

Comment thread udapi/core/tests/external_tests.sh Outdated
#!/bin/bash

udapy read.Conllu filename=UD_Czech_sample.conllu write.Conllu > out.conllu && diff UD_Czech_sample.conllu out.conllu
udapy read.Conllu filename=data/UD_Czech_sample.conllu write.Conllu > out.conllu && diff data/UD_Czech_sample.conllu out.conllu

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VincTheSecond

Copy link
Copy Markdown

I merge this branch for now, but there are still some problems (see #24)

@VincTheSecond VincTheSecond merged commit ba3fcbf into master Dec 19, 2016
@martinpopel martinpopel deleted the pytest branch January 9, 2017 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants