Page MenuHomeSoftware Heritage

Fix '# fmt' directives.
ClosedPublic

Authored by vlorentz on Dec 23 2020, 10:43 AM.

Details

Summary

They were not aligned properly, which causes Black to crash:

$ black --version
black, version 20.8b1

$ cat test.py
def f():
    # fmt: off
    if True:
        print()
        # fmt: on

def g():
    pass

$ black test.py
error: cannot format test.py: INTERNAL ERROR: Black produced code that is not equivalent to the source.  Please report a bug on https://github.com/psf/black/issues.  This diff might be helpful: /tmp/blk_phpp_27o.log
Oh no! ๐Ÿ’ฅ ๐Ÿ’” ๐Ÿ’ฅ
1 file failed to reformat.

https://github.com/psf/black/issues/569

Diff Detail

Repository
rDDEP Push deposit
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D4784 (id=16942)

Could not rebase; Attempt merge onto b85ca5f976...

Updating b85ca5f9..07b0119f
Fast-forward
 swh/deposit/tests/api/test_collection.py           | 326 +---------
 .../tests/api/test_collection_add_to_origin.py     | 157 +++++
 swh/deposit/tests/api/test_collection_post_atom.py | 334 +++++++---
 .../tests/api/test_collection_post_binary.py       | 251 +-------
 .../tests/api/test_collection_post_metadata.py     | 275 --------
 .../tests/api/test_collection_reuse_slug.py        | 241 +++++++
 swh/deposit/tests/api/test_deposit_update.py       | 708 +--------------------
 swh/deposit/tests/api/test_deposit_update_atom.py  | 630 ++++++++++++++++++
 .../tests/api/test_deposit_update_binary.py        | 437 +++++++++++++
 swh/deposit/tests/cli/test_client.py               |   3 +-
 10 files changed, 1706 insertions(+), 1656 deletions(-)
 create mode 100644 swh/deposit/tests/api/test_collection_add_to_origin.py
 delete mode 100644 swh/deposit/tests/api/test_collection_post_metadata.py
 create mode 100644 swh/deposit/tests/api/test_collection_reuse_slug.py
 create mode 100644 swh/deposit/tests/api/test_deposit_update_atom.py
 create mode 100644 swh/deposit/tests/api/test_deposit_update_binary.py
Changes applied before test
commit 07b0119f30156d3abcca35988999203615eec3c5
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Dec 23 10:42:14 2020 +0100

    Fix '# fmt' directives.
    
    They were not aligned properly, which causes Black to crash:
$ black --version
black, version 20.8b1

$ cat test.py
def f():
    # fmt: off
    if True:
        print()
        # fmt: on

def g():
    pass

$ black test.py
error: cannot format test.py: INTERNAL ERROR: Black produced code that is not equivalent to the source.  Please report a bug on https://github.com/psf/black/issues.  This diff might be helpful: /tmp/blk_phpp_27o.log
Oh no! ๐Ÿ’ฅ ๐Ÿ’” ๐Ÿ’ฅ
1 file failed to reformat.
```

commit edf97f4f613bb1137fb1f15e63a3f199847f6c29
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date: Tue Dec 22 17:23:34 2020 +0100

Reorganize POST/PUT SWORD tests

To group them more logically.
See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/497/ for more details.
This revision is now accepted and ready to land.Dec 30 2020, 11:04 AM
This revision was landed with ongoing or failed builds.Jan 4 2021, 3:49 PM
Closed by commit rDDEP1d25be5c9e8d: Fix '# fmt' directives. (authored by vlorentz). ยท Explain Why
This revision was automatically updated to reflect the committed changes.

Build is green

Patch application report for D4784 (id=17003)

Could not rebase; Attempt merge onto b85ca5f976...

Updating b85ca5f9..1d25be5c
Fast-forward
 swh/deposit/tests/api/test_collection.py           | 326 +---------
 .../tests/api/test_collection_add_to_origin.py     | 157 +++++
 swh/deposit/tests/api/test_collection_post_atom.py | 334 +++++++---
 .../tests/api/test_collection_post_binary.py       | 251 +-------
 .../tests/api/test_collection_post_metadata.py     | 275 --------
 .../tests/api/test_collection_reuse_slug.py        | 241 +++++++
 swh/deposit/tests/api/test_deposit_update.py       | 708 +--------------------
 swh/deposit/tests/api/test_deposit_update_atom.py  | 630 ++++++++++++++++++
 .../tests/api/test_deposit_update_binary.py        | 437 +++++++++++++
 swh/deposit/tests/cli/test_client.py               |   3 +-
 10 files changed, 1706 insertions(+), 1656 deletions(-)
 create mode 100644 swh/deposit/tests/api/test_collection_add_to_origin.py
 delete mode 100644 swh/deposit/tests/api/test_collection_post_metadata.py
 create mode 100644 swh/deposit/tests/api/test_collection_reuse_slug.py
 create mode 100644 swh/deposit/tests/api/test_deposit_update_atom.py
 create mode 100644 swh/deposit/tests/api/test_deposit_update_binary.py
Changes applied before test
commit 1d25be5c9e8d466f1e4e457740f3090bdf5cf778
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Dec 23 10:42:14 2020 +0100

    Fix '# fmt' directives.
    
    They were not aligned properly, which causes Black to crash:
$ black --version
black, version 20.8b1

$ cat test.py
def f():
    # fmt: off
    if True:
        print()
        # fmt: on

def g():
    pass

$ black test.py
error: cannot format test.py: INTERNAL ERROR: Black produced code that is not equivalent to the source.  Please report a bug on https://github.com/psf/black/issues.  This diff might be helpful: /tmp/blk_phpp_27o.log
Oh no! ๐Ÿ’ฅ ๐Ÿ’” ๐Ÿ’ฅ
1 file failed to reformat.
```

commit bbe591d3f7de496c5b24fb14c8f21737a1d9fc74
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date: Tue Dec 22 17:23:34 2020 +0100

Reorganize POST/PUT SWORD tests

To group them more logically.
See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/506/ for more details.