23andMe / Yamale

A schema and validator for YAML.
MIT License
680 stars 89 forks source link

replace try:/expect: by 'with pytest.raise(ValueError):' #80

Closed abourree closed 4 years ago

abourree commented 4 years ago

On my Linux box, running test_command_line.py never end. I search in Google and found nothing. I disable all test inside and add them one by one, only tests with try/expect: stuck pytest

I Google how to expect exception with pytest: asserting exceptions with pytest

I replace all try:/expect: with pytest.raise() and then:

abourree commented 4 years ago

The Travis CI build failed only on test_empty_schema_file in test_command_line.py as I explain in my commit. Empty schema issue is not fully corrected: it is not corrected on command line only

abourree commented 4 years ago

OK, issue Empty schema issue is well fix, test was baddy written, I fix it by adding on data file and run test on it.

abourree commented 4 years ago

test_bad_dir test works

mildebrandt commented 4 years ago

On my Linux box, running test_command_line.py never end.

I'm curious why the tests never completed. How do you run the tests? Can you run make test to see if that works with the original code?

I agree with this PR, I would just like to know why it was hanging. Thanks!

abourree commented 4 years ago

With non empty data.yaml that git commit accept as change

abourree commented 4 years ago

On my Linux box, running test_command_line.py never end.

I'm curious why the tests never completed. How do you run the tests? Can you run make test to see if that works with the original code?

I agree with this PR, I would just like to know why it was hanging. Thanks!

I'm very beginner in Python I use pytest from commande line to run tests I take a try to "make test", after pip install tox, I get:

action: GLOB, msg: packaging
cwd: /home/abourree/Projects/Yamale
cmd: /usr/bin/python3 setup.py sdist --formats=zip --dist-dir /home/abourree/Projects/Yamale/.tox/dist
running sdist
running egg_info
error: [Errno 13] Permission denied

I continue with pytest

mildebrandt commented 4 years ago

Can you try running in an virtual environment:

python3 -m venv ./venv
source ./venv/bin/activate
pip install -e .
make test