Skip to content

Move tox to pytest#197

Merged
chinmayshah99 merged 8 commits intoOpenMined:devfrom
alejandrosame:fix/tox-to-pytest
Jul 19, 2020
Merged

Move tox to pytest#197
chinmayshah99 merged 8 commits intoOpenMined:devfrom
alejandrosame:fix/tox-to-pytest

Conversation

@alejandrosame
Copy link
Copy Markdown
Member

Description

Fixes #137 and #192. Apart from substituting tox with pytest testing, Makefile and Github workflow files have been aligned for consitency. Since right now, we lack meaningful Python code, coverage dependency and code has been deleted also for simplicity.

Affected Dependencies

Tox deleted. Coverage deleted.

How has this been tested?

Checklist

@chinmayshah99
Copy link
Copy Markdown
Member

@alejandrosame the tests are failing.
Also, is this tested on a system with conda installed?

@alejandrosame
Copy link
Copy Markdown
Member Author

alejandrosame commented Jul 13, 2020

@chinmayshah99 If you check the log, the error is related to the current bug we have with bounds. If you want, I can already deactivate the tests for bounded methods in this PR since it is more or less a related issue (having consistent tests ASAP).

Regarding conda, they have not been tested using conda. As the changes show, pipenv was added to Github actions for consistency with Docker and host execution. I think validating conda support should be a separate issue/PR (it will require also more documentation updates, new github actions, etc).

@chinmayshah99
Copy link
Copy Markdown
Member

chinmayshah99 commented Jul 13, 2020 via email

Comment thread setup.cfg Outdated
@@ -13,7 +13,7 @@ replace = __version__ = "{new_version}"

[pycodestyle]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this needed now that we have removed pycodestyle?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Indeed it is not needed since we introduced Black. I'll delete the section.

@chinmayshah99
Copy link
Copy Markdown
Member

Error when running make test

cs@cs-VirtualBox:~/Desktop/PyDP$ make test
pipenv run black ./ --check --diff
All done! ✨ 🍰 ✨
22 files would be left unchanged.
pipenv run ./run-clang-format.py -r src/bindings/
Traceback (most recent call last):
  File "/home/cs/.local/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/home/cs/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/cs/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 696, in main
    _verify_python3_env()
  File "/home/cs/.local/lib/python3.6/site-packages/pipenv/vendor/click/_unicodefun.py", line 124, in _verify_python3_env
    ' mitigation steps.' + extra
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/en/7.x/python3/ for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8
Makefile:56: recipe for target 'check-style-cpp' failed
make: *** [check-style-cpp] Error 1

Though I can add these environment variables, this error is not desirable.

@alejandrosame
Copy link
Copy Markdown
Member Author

alejandrosame commented Jul 14, 2020

Error when running make test

cs@cs-VirtualBox:~/Desktop/PyDP$ make test
pipenv run black ./ --check --diff
All done! ✨ 🍰 ✨
22 files would be left unchanged.
pipenv run ./run-clang-format.py -r src/bindings/
Traceback (most recent call last):
  File "/home/cs/.local/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/home/cs/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/cs/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 696, in main
    _verify_python3_env()
  File "/home/cs/.local/lib/python3.6/site-packages/pipenv/vendor/click/_unicodefun.py", line 124, in _verify_python3_env
    ' mitigation steps.' + extra
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/en/7.x/python3/ for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8
Makefile:56: recipe for target 'check-style-cpp' failed
make: *** [check-style-cpp] Error 1

Though I can add these environment variables, this error is not desirable.

I added an ENV file so Pipenv automatically loads those variables inside the virtualenv. That should fix the issue. Can you please confirm that it fixes the execution of make test in your system?

@chinmayshah99
Copy link
Copy Markdown
Member

I added an ENV file so Pipenv automatically loads those variables inside the virtualenv. That should fix the issue. Can you please confirm that it fixes the execution of make test in your system?

This works well! Just to confirm, there is no-inplace editing right? The code does not automatically re-format the correct code even though it suggests what needs to be done. Can we add that if it's possible?

@alejandrosame
Copy link
Copy Markdown
Member Author

I added an ENV file so Pipenv automatically loads those variables inside the virtualenv. That should fix the issue. Can you please confirm that it fixes the execution of make test in your system?

This works well! Just to confirm, there is no-inplace editing right? The code does not automatically re-format the correct code even though it suggests what needs to be done. Can we add that if it's possible?

I wouldn't overload make test with in-place editing. In my opinion, the easiest workflow is to hook the relevant formatting functions to the editor, so the code is formatted every time is saved. That's helpful because one gets to see the actual expected formatting in the editor, and, in my opinion, that helps getting used to the style. Therefore, I think we should notify this to contributors, so they know that possibility exists.

Apart from that, for those that can't arrange the editor (or wouldn't care because, for example, they just want to quickly make a one time contribution) we could provide new formatting actions. That way, make test can announce that they should run, for example, make format-code to automatically format the faulty files.

What do you think?

@chinmayshah99
Copy link
Copy Markdown
Member

Apart from that, for those that can't arrange the editor (or wouldn't care because, for example, they just want to quickly make a one time contribution) we could provide new formatting actions. That way, make test can announce that they should run, for example, make format-code to automatically format the faulty files.

What do you think?

Yeah, we can add that!

Also can we also add make build that just builds/ run the ./build_pydp.sh?

@alejandrosame
Copy link
Copy Markdown
Member Author

Yeah, we can add that!

Also can we also add make build that just builds/ run the ./build_pydp.sh?

Done on the last 2 commits.

Copy link
Copy Markdown
Member

@chinmayshah99 chinmayshah99 left a comment

Choose a reason for hiding this comment

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

LGTM! Need to confirm if all tests run perfectly :)

@chinmayshah99 chinmayshah99 merged commit 6a42512 into OpenMined:dev Jul 19, 2020
@alejandrosame alejandrosame deleted the fix/tox-to-pytest branch August 15, 2020 09:38
dvadym pushed a commit to dvadym/PyDP that referenced this pull request Jul 3, 2022
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.

Add pytest to github actions

2 participants