[PATCH v5 2/2] gnu: Add online-judge-tools

  • Done
  • quality assurance status badge
Details
2 participants
  • gemmaro
  • Christopher Baines
Owner
unassigned
Submitted by
gemmaro
Severity
normal
G
G
gemmaro wrote on 26 Aug 2023 08:22
(name . gemmaro)(address . gemmaro.dev@gmail.com)
9912c744b6609ff144624baffa4a8a3810006e60.1693030921.git.gemmaro.dev@gmail.com
* gnu/packages/python-xyz.scm (online-judge-tools): New variable.
* gnu/packages/patches/online-judge-tools.patch, gnu/local.mk: Add patch file.
---
gnu/local.mk | 3 +-
gnu/packages/patches/online-judge-tools.patch | 62 +++++++++++++++++++
gnu/packages/python-xyz.scm | 35 +++++++++++
3 files changed, 99 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/online-judge-tools.patch

Toggle diff (130 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 5ad5fb646f..e9a7440224 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2132,7 +2132,8 @@ dist_patch_DATA = \
%D%/packages/patches/zig-do-not-link-against-librt.patch \
%D%/packages/patches/zig-use-system-paths.patch \
%D%/packages/patches/zsh-egrep-failing-test.patch \
- %D%/packages/patches/python-online-judge-api-client-tests.patch
+ %D%/packages/patches/python-online-judge-api-client-tests.patch \
+ %D%/packages/patches/online-judge-tools.patch
MISC_DISTRO_FILES = \
%D%/packages/ld-wrapper.in
diff --git a/gnu/packages/patches/online-judge-tools.patch b/gnu/packages/patches/online-judge-tools.patch
new file mode 100644
index 0000000000..9e016d7104
--- /dev/null
+++ b/gnu/packages/patches/online-judge-tools.patch
@@ -0,0 +1,62 @@
+Skip failing tests and an assertion. The skipped tests require network
+connections.
+
+--- a/tests/command_download.py
++++ b/tests/command_download.py
+@@ -90,6 +90,7 @@ class DownloadTest(unittest.TestCase):
+ def snippet_call_download_failure(self, *args, **kwargs):
+ tests.command_download.snippet_call_download_failure(self, *args, **kwargs)
+
++ @unittest.skip("Disabled by Guix")
+ def test_call_download_atcoder_abc114_c(self):
+ self.snippet_call_download('https://atcoder.jp/contests/abc114/tasks/abc114_c', [
+ {
+@@ -106,6 +107,7 @@ class DownloadTest(unittest.TestCase):
+ },
+ ], type='json')
+
++ @unittest.skip("Disabled by Guix")
+ def test_call_download_atcoder_abc003_4(self):
+ self.snippet_call_download('https://atcoder.jp/contests/abc003/tasks/abc003_4', [
+ {
+@@ -126,9 +128,11 @@ class DownloadTest(unittest.TestCase):
+ },
+ ], type='json')
+
++ @unittest.skip("Disabled by Guix")
+ def test_call_download_invalid_url(self):
+ self.snippet_call_download_failure('http://abc001.contest.atcoder.jp/tasks/abc001_100')
+
++ @unittest.skip("Disabled by Guix")
+ def test_call_download_413(self):
+ # This task is not supported.
+ self.snippet_call_download_failure('https://chokudai001.contest.atcoder.jp/tasks/chokudai_001_a')
+@@ -141,13 +145,16 @@ class DownloadInvalidTest(unittest.TestCase):
+ def snippet_call_download_twice(self, *args, **kwargs):
+ tests.command_download.snippet_call_download_twice(self, *args, **kwargs)
+
++ @unittest.skip("Disabled by Guix")
+ def test_call_download_invalid(self):
+ self.snippet_call_download_failure('https://not_exist_contest.jp/tasks/001_a')
+
++ @unittest.skip("Disabled by Guix")
+ def test_call_download_no_sample_found(self):
+ self.snippet_call_download_failure('https://atcoder.jp/contests/tenka1-2013-quala/tasks/tenka1_2013_qualA_a')
+ self.snippet_call_download_failure('https://open.kattis.com/problems/hello')
+
++ @unittest.skip("Disabled by Guix")
+ def test_call_download_twice(self):
+ self.snippet_call_download_twice('https://atcoder.jp/contests/abc114/tasks/abc114_c', 'https://atcoder.jp/contests/abc003/tasks/abc003_4', [
+ {
+
+--- a/tests/command_test.py
++++ b/tests/command_test.py
+@@ -1319,7 +1319,7 @@ class TestTest(unittest.TestCase):
+ timer = threading.Timer(1.0, send_keyboard_interrupt)
+ timer.start()
+ result = tests.utils.run_in_sandbox(args=['-v', 'test', '-c', tests.utils.python_c("import time; time.sleep(10) # {}".format(marker_for_callee)), 'test/{}-1.in'.format(marker_for_caller)], files=files)
+- self.assertNotEqual(result['proc'].returncode, 0)
++ # self.assertNotEqual(result['proc'].returncode, 0)
+
+ # check there are no processes whose command-line arguments contains the marker word
+ for cmdline in pathlib.Path('/proc').glob('*/cmdline'):
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 315994e488..dad7e60961 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -24287,6 +24287,41 @@ (define-public python-online-judge-api-client
jmerle/competitive-companion.")
(license license:expat)))
+(define-public online-judge-tools
+ (package
+ (name "online-judge-tools")
+ (version "11.5.1")
+ ;; Source distributions are not uploaded to PyPI.
+ ;; https://pypi.org/project/online-judge-tools/11.5.1/#files
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/online-judge-tools/oj")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0zkzmmjgjb6lyrzq1ip54cpnp7al9a7mcyjyi5vx58bvnx3q0c6m"))
+ (patches (search-patches "online-judge-tools.patch"))))
+ (build-system python-build-system)
+ (arguments
+ (list #:phases #~(modify-phases %standard-phases
+ ;; These tests require network connections
+ (add-after 'unpack 'remove-failing-test
+ (lambda _
+ (delete-file "tests/command_version.py") #t)))))
+ (inputs (list time))
+ (propagated-inputs (list python-online-judge-api-client python-colorama
+ python-requests))
+ (home-page "https://github.com/online-judge-tools/oj")
+ (synopsis "Command to help solving problems on various online judges")
+ (description
+ "@command{oj} is a command line tool to help solving problems on
+various online judges. This command automates downloading sample
+cases, generating additional test cases, testing for your code, and
+submitting it.")
+ (license license:expat)))
+
(define-public python-parso
(package
(name "python-parso")
--
2.41.0
C
C
Christopher Baines wrote on 30 Oct 2023 12:28
(name . gemmaro)(address . gemmaro.dev@gmail.com)(address . 65545-done@debbugs.gnu.org)
87il6oxs8p.fsf@cbaines.net
gemmaro <gemmaro.dev@gmail.com> writes:

Toggle quote (9 lines)
> * gnu/packages/python-xyz.scm (online-judge-tools): New variable.
> * gnu/packages/patches/online-judge-tools.patch, gnu/local.mk: Add patch file.
> ---
> gnu/local.mk | 3 +-
> gnu/packages/patches/online-judge-tools.patch | 62 +++++++++++++++++++
> gnu/packages/python-xyz.scm | 35 +++++++++++
> 3 files changed, 99 insertions(+), 1 deletion(-)
> create mode 100644 gnu/packages/patches/online-judge-tools.patch

Hey,

I'm not a big fan of the "big patch to disable tests" approach here, but
it works, so I've gone ahead and pushed these two patches to master as
789ef6837f9794c02bc53a854aacfdf04d3384cf.

It would be good to see if the patches could be removed in the future
though.

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmU/k8ZfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xd4Og//ddWxiOSuKhnOSMzqE1xjtGd6ve1zD6zv
4Xm7Lxk6odT5Zq6FDVh+UdeUP7kAyxdLZZevGccZaB1LAodyU1nmOC+OANKwCfY3
ODvFe3oVOOkqjgb/HZ/XXKOHWoePf+Qplwmf3URe2Ls1/Mab3WvRsMlMk0/ky5es
nbndCvJ0K86yn6+LTh4yKrifeM7X4b7BFt3bA0WvE5mdDp3pBNF5zl1TgWJEwbNk
2PBsklS4fc1z1660qGvMjGme6m2IHrEWSLRuw79WK8q6a1eYcoY5iTFLg4l/yH5T
EGS0yRqopnDbCMq5xC907l+0swTfwUq4Ut+BXaRIjmwh0cWSDJXaxuQVj+Xy2Ch0
KVqvQ7y89b8KimIxe9oyUWnc1UcP6peYniaxKv0geP82Xpji6VL5kD7c06tIEmgq
FMKO+CEOM2JIIXcwKoi+1+SdAZEIKgKxzqou9LBSqa4wAltMr+WlzXb/C4aaVMuh
Xe/izzEpdr/iB1y6RCHuL5cD/jWh5HJ6XCZcJ4mag+imrArV3MpS5avE+FDht0x2
Xp0xQWlJaju1rFQN9wIqvdtZxwnywyM0mvEzMK3YcWx7PQmR/nbHDwBYVscSDEU1
g0c6JKQ7QDlcFG+LLXgDuMopYdCR7w9RNepckT2H5m0rfUgWsM+aNpAH00BI+lgc
sQTY9W4uu7c=
=aLr3
-----END PGP SIGNATURE-----

Closed
?