Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Jan 3, 2020

Conversation

abourree
Copy link
Contributor

@abourree abourree commented Jan 3, 2020

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:

  • excepted test_bad_dir witch I mark skip, none get stuck
  • test_empty_schema_file now failed because it didn't raise ValueError

@abourree
Copy link
Contributor Author

abourree commented Jan 3, 2020

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
Copy link
Contributor Author

abourree commented Jan 3, 2020

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
Copy link
Contributor Author

abourree commented Jan 3, 2020

test_bad_dir test works

command_line._router(
'yamale/tests/command_line_fixtures/empty_schema',
'yamale/tests/command_line_fixtures/empty_schema/data.yaml',

Choose a reason for hiding this comment

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

Nice find! This test was missing the final assert False. Please add the data.yaml file to git. Thanks!

@mildebrandt
Copy link

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
Copy link
Contributor Author

abourree commented Jan 3, 2020

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

@abourree
Copy link
Contributor Author

abourree commented Jan 3, 2020

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
Copy link

Can you try running in an virtual environment:

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

@mildebrandt mildebrandt merged commit 750a8e8 into 23andMe:master Jan 3, 2020
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