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
python.pkgs.black: 19.10b0 -> 20.8b1 #96456
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Some stylistic fixes
- Main package builds via nix-review, tested some downstream but not all.
- Commits LGTM
@@ -23,14 +23,19 @@ buildPythonPackage rec { | |||
|
|||
# Don't know why these tests fails | |||
# Disable test_expression_diff, because it fails on darwin | |||
# Disable Primer* tests because they depend on black beeing in PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better just to add black to the path for the purposes of this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late reply. Since I'm fairly new to the nix world I'm not sure how to do this. Something like
preCheck = ''
export PATH=${black}
'';
will obviously not work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw some examples of
preCheck = ''
export PATH="$PATH:$out/bin"
'';
in nixpkgs.
@@ -23,14 +23,19 @@ buildPythonPackage rec { | |||
|
|||
# Don't know why these tests fails | |||
# Disable test_expression_diff, because it fails on darwin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a good time to switch to pytestCheckHook
. See https://github.com/NixOS/nixpkgs/blob/6770ab0771703b573a0a1c1f6c238352bebc9c31/doc/languages-frameworks/python.section.md#using-pytestcheckhook
This would allow flexible disabling of tests for darwin-only. Also setting LC_ALL or PATH could happen at preCheck
Quit Partial logs from
|
Shall I do something about the errors that occured while running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Diff mostly LGTM, few small formatting things
- Commits LGTM
- Didn't try build today, don't have access to a build PC today.
, regex | ||
, toml | ||
, typed-ast | ||
, typing-extensions }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
, typing-extensions }: | |
, typing-extensions | |
}: |
"test_expression_diff" | ||
]; | ||
|
||
propagatedBuildInputs = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be moved up, above checkInputs
.
checkInputs = [ pytestCheckHook ]; | ||
|
||
preCheck = '' | ||
export PATH="$PATH:$out/bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does LC_ALL still need set?
# Don't know why these tests fails | ||
"test_cache_multiple_files" | ||
"test_failed_formatting_does_not_get_cached" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you maybe show a log of why these fail, so people can help? No real objection to disabling it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attached the log below. I don't know why the tests fail but they seem to fail this way consistently.
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: /build/black-20.8b1
collected 150 items / 2 deselected / 148 selected
tests/test_black.py .........F..............................F........... [ 35%]
..................................................................xxx... [ 83%]
.................. [ 95%]
tests/test_primer.py ...... [100%]
=================================== FAILURES ===================================
___________________ BlackTestCase.test_cache_multiple_files ____________________
self = <tests.test_black.BlackTestCase testMethod=test_cache_multiple_files>
@event_loop()
def test_cache_multiple_files(self) -> None:
mode = DEFAULT_MODE
with cache_dir() as workspace, patch(
"black.ProcessPoolExecutor", new=ThreadPoolExecutor
):
one = (workspace / "one.py").resolve()
with one.open("w") as fobj:
fobj.write("print('hello')")
two = (workspace / "two.py").resolve()
with two.open("w") as fobj:
fobj.write("print('hello')")
black.write_cache({}, [one], mode)
self.invokeBlack([str(workspace)])
with one.open("r") as fobj:
self.assertEqual(fobj.read(), "print('hello')")
with two.open("r") as fobj:
> self.assertEqual(fobj.read(), 'print("hello")\n')
E AssertionError: "print('hello')" != 'print("hello")\n'
E - print('hello')
E ? ^ ^
E + print("hello")
E
E ? ^ ^
E +
tests/test_black.py:1381: AssertionError
___________ BlackTestCase.test_failed_formatting_does_not_get_cached ___________
self = <tests.test_black.BlackTestCase testMethod=test_failed_formatting_does_not_get_cached>
@event_loop()
def test_failed_formatting_does_not_get_cached(self) -> None:
mode = DEFAULT_MODE
with cache_dir() as workspace, patch(
"black.ProcessPoolExecutor", new=ThreadPoolExecutor
):
failing = (workspace / "failing.py").resolve()
with failing.open("w") as fobj:
fobj.write("not actually python")
clean = (workspace / "clean.py").resolve()
with clean.open("w") as fobj:
fobj.write('print("hello")\n')
> self.invokeBlack([str(workspace)], exit_code=123)
tests/test_black.py:1456:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_black.py:196: in invokeBlack
self.assertEqual(
E AssertionError: 0 != 123 : Failed with args: ['--verbose', '--config', '/build/black-20.8b1/tests/empty.toml', '/build/tmpg7cs37d1']
E stdout: ''
E stderr: '/build/tmpg7cs37d1/clean.py ignored: matches the --exclude regular expression\n/build/tmpg7cs37d1/failing.py ignored: matches the --exclude regular expression\nNo Python files are present to be formatted. Nothing to do 😴\n'
E exception: None
=============================== warnings summary ===============================
/nix/store/nlvjjvb9471dbpdj8fhdih0ak90cq9d9-python3.8-aiohttp-3.6.2/lib/python3.8/site-packages/aiohttp/helpers.py:107
/nix/store/nlvjjvb9471dbpdj8fhdih0ak90cq9d9-python3.8-aiohttp-3.6.2/lib/python3.8/site-packages/aiohttp/helpers.py:107: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
def noop(*args, **kwargs): # type: ignore
tests/test_black.py: 12 tests with warnings
/nix/store/nlvjjvb9471dbpdj8fhdih0ak90cq9d9-python3.8-aiohttp-3.6.2/lib/python3.8/site-packages/aiohttp/connector.py:964: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
hosts = await asyncio.shield(self._resolve_host(
-- Docs: https://docs.pytest.org/en/latest/warnings.html
=========================== short test summary info ============================
FAILED tests/test_black.py::BlackTestCase::test_cache_multiple_files - Assert...
FAILED tests/test_black.py::BlackTestCase::test_failed_formatting_does_not_get_cached
===== 2 failed, 143 passed, 2 deselected, 3 xfailed, 13 warnings in 29.16s =====
builder for '/nix/store/sjzrn2vmvw8b782n7pjsbdac1r2jmp7q-python3.8-black-20.8b1.drv' failed with exit code 1
error: build of '/nix/store/sjzrn2vmvw8b782n7pjsbdac1r2jmp7q-python3.8-black-20.8b1.drv' failed
If the failures are broken on |
Running
The build of
|
Result of 2 packages marked as broken and skipped:
1 package blacklisted:
5 packages failed to build:
58 packages built:
|
The 5 failures above are also on master. |
@TheDelus I made a PR to your branch with the requested formatting changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look better, thanks!
Additional improvements can be done in another PR
failures are all related to pytest-tesmon
failing in master right now
[45 built (2 failed), 32 copied (76.2 MiB), 18.9 MiB DL]
error: build of '/nix/store/3vcjwdbkw6gfyn817x01amli7ilca8b9-env.drv' failed
https://github.com/NixOS/nixpkgs/pull/96456
2 packages marked as broken and skipped:
bareos pepper
1 package blacklisted:
tests.nixos-functions.nixosTest-test
21 packages failed to build:
ceph ceph-client fava flexget libceph mnemosyne python37Packages.WSME python37Packages.cheroot python37Packages.cherrypy python37Packages.pyalgotrade python37Packages.ws4py python37Packages.zerobin python38Packages.WSME python38Packages.cheroot python38Packages.cherrypy python38Packages.pyalgotrade python38Packages.ws4py python38Packages.zerobin sabnzbd sambaFull tribler
42 packages built:
black black-macchiato errbot nix-prefetch-github noto-fonts-emoji pypi2nix python37Packages.backports_functools_lru_cache python37Packages.black python37Packages.black-macchiato python37Packages.graphql-server-core python37Packages.irc python37Packages.jaraco_collections python37Packages.jaraco_functools python37Packages.jaraco_logging python37Packages.jaraco_text python37Packages.nix-prefetch-github python37Packages.nototools python37Packages.papermill python37Packages.portend python37Packages.pyls-black python37Packages.pytest-black python37Packages.slackclient python37Packages.stumpy python37Packages.tempora python37Packages.uarray python38Packages.backports_functools_lru_cache python38Packages.graphql-server-core python38Packages.irc python38Packages.jaraco_collections python38Packages.jaraco_functools python38Packages.jaraco_logging python38Packages.jaraco_text python38Packages.nototools python38Packages.papermill python38Packages.portend python38Packages.pyls-black python38Packages.pytest-black python38Packages.slackclient python38Packages.stumpy python38Packages.tempora python38Packages.uarray twitter-color-emoji
In PR NixOS#96456, black was upgraded from 19.10b0 to 20.8b1. This new version of black depends on the dataclasses module, but that was only introduced into the standard library in Python 3.7; earlier versions of Python require the backport package of the same name. This commit addresses the missing dependency.
In PR #96456, black was upgraded from 19.10b0 to 20.8b1. This new version of black depends on the dataclasses module, but that was only introduced into the standard library in Python 3.7; earlier versions of Python require the backport package of the same name. This commit addresses the missing dependency.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)