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

Mark tests requiring network access #1526

Closed
mcepl opened this issue Feb 25, 2021 · 2 comments · Fixed by #1527
Closed

Mark tests requiring network access #1526

mcepl opened this issue Feb 25, 2021 · 2 comments · Fixed by #1527

Comments

@mcepl
Copy link
Contributor

mcepl commented Feb 25, 2021

All builds (and running test suites as part of them) of OpenSUSE packages (the same for every other Linux or Mac distribution) happen in the chrooted environment without the network access, which makes running of the test suite for this package extremely awkward. Most of tests fail because they require network access, which is a bad idea even for other reasons (mocking is the way to go).

skip_network_tests.patch is the solution of my problem, marking all tests requiring network access appropriately, and then skipping so marked ones.

@MSeal
Copy link
Contributor

MSeal commented Feb 26, 2021

Thanks for @mcepl ! And thanks for opening these across several projects. I agree that network requests during unittests is a bad idea. The chromium webpdf setup is a little annoying to both test the lazy download/install and not have network so we haven't had the time / energy to mock that interaction in a meaningful manner.

I made a PR with your patch applied. Were there other test you saw that needed this marking beyond this?

@mcepl
Copy link
Contributor Author

mcepl commented Feb 26, 2021

I made a PR with your patch applied. Were there other test you saw that needed this marking beyond this?

Just with this (and setting JUPYTER_PATH) I had tests passing with this %check section (don't bother about details, it is basically bash syntax with some macros thrown in):

%check
pushd docs
export LANG=en_US.UTF-8
export PYTHONDONTWRITEBYTECODE=1
export JUPYTER_PATH=%{buildroot}%{_datadir}/jupyter
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib}
$python -B -m ipykernel.kernelspec --user
pytest-%{$python_bin_suffix} -v -k 'not network' --pyargs nbconvert
}
popd

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 a pull request may close this issue.

2 participants