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

[CI] Run unit test with non-editable installation #845

Merged
merged 1 commit into from
Aug 5, 2020

Conversation

mthrok
Copy link
Collaborator

@mthrok mthrok commented Jul 31, 2020

We have been running unit test with editable installation. (i.e. python setup.py develop), with which we missed issues like #842.

This PR makes installation in CI non-editable, and change test directory structure so that the source code will not shadow the installed version of torchaudio. With simple pytest test, pytest modifies and prepend checked out repository, which shadows the installed version.

To remedy this, the whole test suites has been moved from ./test to ./test/torchaudio_unittest. This adds nice module structure to our test code and we can do absolute import in each test module, which makes it possible again to run test with python -m unittest torchaudio_unittest/XXX.py

This change does not affect the regular development process (python setup.py develop && pytest test)

@mthrok mthrok force-pushed the tweak-unittest-job branch from 91dd92b to 30aa240 Compare August 4, 2020 20:26
@mthrok mthrok marked this pull request as ready for review August 4, 2020 21:09
@mthrok mthrok requested a review from vincentqb August 4, 2020 21:09
@@ -6,5 +6,5 @@ eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')"
conda activate ./env

python -m torch.utils.collect_env
pytest --cov=torchaudio --junitxml=test-results/junit.xml -v --durations 20 test
flake8 torchaudio test
Copy link
Contributor

@vincentqb vincentqb Aug 4, 2020

Choose a reason for hiding this comment

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

flake8 is now tested separately, hence why this is removed here, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that's correct.

fi
cd test
pytest "${args[@]}" "${common_args[@]}" torchaudio_unittest
Copy link
Contributor

Choose a reason for hiding this comment

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

could the following command work without moving files from test/ to test/torchaudio_unittest/?

pytest "${args[@]}" "${common_args[@]}" test

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

An alternative would be remove source torchaudio directory.

  1. do rm torchaudio before running test - ugly
  2. Move the source code to src. See this. - though this is clean and standard way, it involves the reorg of whole source code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, thanks for pointing these out! I'm ok with the approach suggested here -- though neither pytorch nor the other libraries do it.

cc @cpuhrsch @fmassa @zhangguanheng66

Copy link
Contributor

@vincentqb vincentqb left a comment

Choose a reason for hiding this comment

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

Thanks for figuring out the source of the issue :) What would be an alternative to moving files from test/ to test/torchaudio_unittest/?

Copy link
Contributor

@vincentqb vincentqb left a comment

Choose a reason for hiding this comment

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

LGTM

@mthrok mthrok merged commit 9ba02d5 into pytorch:master Aug 5, 2020
@mthrok
Copy link
Collaborator Author

mthrok commented Aug 5, 2020

Thanks

@mthrok mthrok deleted the tweak-unittest-job branch August 5, 2020 01:11
mthrok pushed a commit to mthrok/audio that referenced this pull request Feb 26, 2021
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