diff mbox series

[bug#53019,1/3] gnu: Add python-codeclimate-test-reporter.

Message ID 20220305231459.22969-1-goodoldpaul@autistici.org
State New
Headers show
Series [bug#53019,1/3] gnu: Add python-codeclimate-test-reporter. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Giacomo Leidi March 5, 2022, 11:14 p.m. UTC
* gnu/packages/python-xyz.scm (python-codeclimate-test-reporter): New variable.
---
 gnu/packages/python-check.scm | 45 +++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)


base-commit: 0c6bf910efd090f0aa0479ba727e5e68655e9b68

Comments

M March 6, 2022, 10:17 a.m. UTC | #1
Giacomo Leidi via Guix-patches via schreef op zo 06-03-2022 om 00:14
[+0100]:
> +     (list git

It's only for tests, so WDYT of 'git-minimal', or even
'git-minimal/fixed'?

Greetings,
Maxime
M March 6, 2022, 10:18 a.m. UTC | #2
Giacomo Leidi via Guix-patches via schreef op zo 06-03-2022 om 00:14
[+0100]:
> +             ;; FIXME: These tests fail with
> +             ;; obscure error messages.
> +             (for-each
> +              (lambda (test-file)
> +                (delete-file test-file))
> +              '("tests/test_reporter.py"
> +                "tests/test_runner.py")))))))

If these tests fail, there's a problem somewhere in need of a fix.
What are the error messages, and have they been reported upstream?

Greetings,
Maxime.
M March 6, 2022, 10:28 a.m. UTC | #3
Giacomo Leidi via Guix-patches via schreef op zo 06-03-2022 om 00:14
[+0100]:
> +  #:use-module (gnu packages version-control)

This creates a cycle between (gnu packages version-control) and
(gnu packages python-check).  To avoid cycles, could

  (a) python-codeclimate-test-reported be moved into a new module

or

  (b) the importing be delayed with (module-ref ...), like in
      (guix build-system gnu)?

By reducing cycles, "guix COMMAND some-package" needs to load less
modules and hence less memory.  There are also some other potential
benefits, e.g. see ‘Faster "guix pull" by incremental compilation and
non-circular modules?’ on guix-devel.

Greetings,
Maxime.
Giacomo Leidi March 14, 2022, 10:12 p.m. UTC | #4
Dear Maxime,

first thank for all your feedback,

On 3/6/22 11:17, Maxime Devos wrote:
> Giacomo Leidi via Guix-patches via schreef op zo 06-03-2022 om 00:14
> [+0100]:
>> +     (list git
> It's only for tests, so WDYT of 'git-minimal', or even
> 'git-minimal/fixed'?
Definitely, fixed.
> Greetings,
> Maxime

Thank you,

Giacomo
Giacomo Leidi March 14, 2022, 10:14 p.m. UTC | #5
Dear Maxime,

On 3/6/22 11:18, Maxime Devos wrote:
> Giacomo Leidi via Guix-patches via schreef op zo 06-03-2022 om 00:14
> [+0100]:
>> +             ;; FIXME: These tests fail with
>> +             ;; obscure error messages.
>> +             (for-each
>> +              (lambda (test-file)
>> +                (delete-file test-file))
>> +              '("tests/test_reporter.py"
>> +                "tests/test_runner.py")))))))
> If these tests fail, there's a problem somewhere in need of a fix.
> What are the error messages, and have they been reported upstream?

It turns out it requires exactly python-coverage@4.3.4. It's now fixed.

Thank you,

Giacomo
Giacomo Leidi March 14, 2022, 10:27 p.m. UTC | #6
Dear Maxime,

On 3/6/22 11:28, Maxime Devos wrote:
> Giacomo Leidi via Guix-patches via schreef op zo 06-03-2022 om 00:14
> [+0100]:
>> +  #:use-module (gnu packages version-control)
> This creates a cycle between (gnu packages version-control) and
> (gnu packages python-check).  To avoid cycles, could
>
>    (a) python-codeclimate-test-reported be moved into a new module
>
> or
>
>    (b) the importing be delayed with (module-ref ...), like in
>        (guix build-system gnu)?
>
> By reducing cycles, "guix COMMAND some-package" needs to load less
> modules and hence less memory.  There are also some other potential
> benefits, e.g. see ‘Faster "guix pull" by incremental compilation and
> non-circular modules?’ on guix-devel.

I wasn't aware of this, thank you. I fixed this by moving 
python-codeclimate-test-reported to (gnu packages python-xyz).

Greetings,

Giacomo
diff mbox series

Patch

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index 05a378601f..2789d65a25 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -13,6 +13,7 @@ 
 ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com>
+;;; Copyright © 2022 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -38,6 +39,7 @@  (define-module (gnu packages python-check)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
@@ -1508,6 +1510,49 @@  (define-public python-pytest-qt
 interaction, like key presses and mouse clicks.")
     (license license:expat)))
 
+(define-public python-codeclimate-test-reporter
+  (package
+    (name "python-codeclimate-test-reporter")
+    (version "0.2.3")
+    (source
+     (origin
+       (method git-fetch)               ;no tests in pypi archive
+       (uri (git-reference
+             (url "https://github.com/codeclimate/python-test-reporter")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0mxph5l3k9ch4hs9l76k4wnmzhd94bylg92lvm2priyn24gkn9a1"))))
+    (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-fixtures-paths
+           (lambda _
+             (substitute* "tests/test_formatter.py"
+               (("\\./tests/fixtures")
+                (string-append (getcwd) "/tests/fixtures")))
+             ;; FIXME: These tests fail with
+             ;; obscure error messages.
+             (for-each
+              (lambda (test-file)
+                (delete-file test-file))
+              '("tests/test_reporter.py"
+                "tests/test_runner.py")))))))
+    (native-inputs
+     (list git
+           python-httpretty
+           python-pytest))
+    (propagated-inputs
+     (list python-coverage
+           python-requests))
+    (home-page "https://github.com/codeclimate/python-test-reporter")
+    (synopsis "Reports test coverage to Code Climate")
+    (description "This package provides @{codclimate-test-reporter}, a Python
+library teport test coverage to Code Climate.")
+    (license license:expat)))
+
 (define-public python-codacy-coverage
   (package
     (name "python-codacy-coverage")