mumuki-python-runner 1.10.2 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfe4c1b7c4a05396eff95054475016150f8625f9986a7470e7ae3616c2ac74ea
4
- data.tar.gz: c2c69063f8ce3905dcca15c0b8c9bbcefcb6ebc28be1d92fb4780f29b97f3b25
3
+ metadata.gz: 5da2caaa7b7e90d3ec1516a5e0bd5450924978e4b8373114a1616e8713da3d59
4
+ data.tar.gz: 4b30fbffe7fc06c373485d50f7538eea34b9ba7ee4398b7949dcb0d2806dfd16
5
5
  SHA512:
6
- metadata.gz: 3661eefa8f35a6992f4632893ef87d04f888c0f56076b73a4a7793d329f37e4a5dda9e09526e14ae1f33e940d8b628966d0da5f2d840163bf9d84600e30a1e43
7
- data.tar.gz: 0b248d700f5a711514f76a34310ef9b2598e6d04d68bffe7cb54d6f59a9404d93949785d3cf4826c0d44f1461b43bca4e9ab08271dd41cfc7642ef686890dc75
6
+ metadata.gz: 21336417b1003c387622f375b8d7f3942453c7b1072cc2077aaf9daf4c1aa074f9984290cb6e028e33718b541a3145e0c13eef817b6956add3705eabbf158e04
7
+ data.tar.gz: 7ab3f25cc8ee5ce1c30094e6eb42c7f69e0c320d6f27759f2d103d8e37fc44fa95b56e6cade0ed4b27b5c0588d2b720a5ea4be789ea60b0a8b6a2b34d08d6bab
@@ -14,6 +14,7 @@ class BasePythonQueryHook < Mumukit::Templates::FileHook
14
14
  <<python
15
15
  # -*- coding: UTF-8 -*-
16
16
  import string, sys, os
17
+ from datetime import datetime, date
17
18
 
18
19
  #{req.extra}
19
20
  #{req.content}
@@ -1,5 +1,6 @@
1
1
  class BasePythonTestHook < Mumukit::Templates::FileHook
2
2
  isolated true
3
+ line_number_offset 8, include_extra: true
3
4
 
4
5
  def tempfile_extension
5
6
  '.py'
@@ -16,6 +17,7 @@ class BasePythonTestHook < Mumukit::Templates::FileHook
16
17
  import unittest
17
18
  import xmlrunner
18
19
  import sys
20
+ from datetime import datetime, date
19
21
 
20
22
  #{request.extra}
21
23
  #{request.content}
@@ -39,6 +41,14 @@ python
39
41
  [output, :errored]
40
42
  end
41
43
 
44
+ def line_number_reference_regexp
45
+ /"#{masked_tempfile_path}", line (\d+)/m
46
+ end
47
+
48
+ def rebuild_line_number_reference(new_line_number)
49
+ "\"#{masked_tempfile_path}\", line #{new_line_number}"
50
+ end
51
+
42
52
  private
43
53
 
44
54
  def test_class(test)
@@ -57,16 +67,31 @@ python
57
67
  failure = test_case.xpath('failure', 'error')
58
68
  error = failure.attribute('type')
59
69
  message = failure.attribute('message')
70
+ assertion_error_message = try_extract_assertion_error(failure)
60
71
 
61
72
  [
62
73
  format_test_name(test_case.attribute('name').to_s),
63
74
  error.nil? ? :passed: :failed,
64
- error.nil? ? '' : "#{error}: #{message}"
75
+ error.nil? ? '' : "#{error}: #{assertion_error_message || message}"
65
76
  ]
66
77
  end
67
78
 
79
+ def try_extract_assertion_error(failure)
80
+ failure.text.split("AssertionError: ")[1]&.rstrip.try do |it|
81
+ it.each_line.count > 1 ? it + "\n" : it
82
+ end
83
+ end
84
+
68
85
  def format_test_name(name)
69
- name.sub('test_', '').gsub('_', ' ').capitalize
86
+ name
87
+ .sub('test_', '')
88
+ .gsub('__PL__', '(')
89
+ .gsub('__PR__', ')')
90
+ .gsub('__DT__', '.')
91
+ .gsub('__CM__', ',')
92
+ .gsub('__QT__', '\'')
93
+ .gsub('__DQ__', '"')
94
+ .gsub('_', ' ')
95
+ .capitalize
70
96
  end
71
97
  end
72
-
data/lib/base/version.rb CHANGED
@@ -1,4 +1,4 @@
1
-
2
- module BasePythonVersionHook
3
- VERSION = '1.10.2'
4
- end
1
+
2
+ module BasePythonVersionHook
3
+ VERSION = '1.12.0'
4
+ end
@@ -7,7 +7,7 @@ In order to solve exercises like this, you will need to create an account and lo
7
7
  First, create a cell with the following code:
8
8
 
9
9
  ```python
10
- !pip install mumuki-xce
10
+ !pip install mumuki-xce --quiet
11
11
 
12
12
  from mumuki import IMumuki
13
13
  mumuki = IMumuki("#...token...#", "#...locale...#")
@@ -7,7 +7,7 @@ Para poder resolver ejercicios como éste, necesitarás ingresar a [`Colab`](htt
7
7
  Primero, creá una celda con el siguiente código:
8
8
 
9
9
  ```python
10
- !pip install mumuki-xce
10
+ !pip install mumuki-xce --quiet
11
11
 
12
12
  from mumuki import IMumuki
13
13
  mumuki = IMumuki("#...token...#", "#...locale...#")
@@ -7,7 +7,7 @@ Para resolver exercícios como este, você precisará fazer login no [`Colab`](h
7
7
  Primeiro, crie uma célula com o seguinte código:
8
8
 
9
9
  ```python
10
- !pip install mumuki-xce
10
+ !pip install mumuki-xce --quiet
11
11
 
12
12
  from mumuki import IMumuki
13
13
  mumuki = IMumuki("#...token...#", "#. . .locale...#")
@@ -3,7 +3,7 @@
3
3
  You will need to use `python` and `pip` in order to solve exercises like this. Please ensure you have those commands locally installed in your computer. Then install `mumuki-xce`:
4
4
 
5
5
  ```shell
6
- pip install mumuki-xce
6
+ pip install mumuki-xce --quiet
7
7
  ```
8
8
 
9
9
  Now you are ready to solve exercises!
@@ -3,7 +3,7 @@
3
3
  Para poder resolver ejercicios como éste, necesitarás utilizar los comandos `python` y `pip`. Antes de comenzar, asegurate de tenerlos instalados. Después, ejecutá el siguiente comando, por única vez (si ya lo hiciste anteriormente, podés saltar al siguente paso):
4
4
 
5
5
  ```shell
6
- pip install mumuki-xce
6
+ pip install mumuki-xce --quiet
7
7
  ```
8
8
 
9
9
  ¡Ya podés empezar a resolver ejercicios!
@@ -3,7 +3,7 @@
3
3
  Para resolver exercícios como este, você precisará usar os comandos `python` e `pip`. Antes de começar, certifique-se de tê-los instalados. Então, execute o seguinte comando, apenas uma vez (se você já fez isso antes, você pode pular para o próximo passo):
4
4
 
5
5
  ```shell
6
- pip install mumuki-xce
6
+ pip install mumuki-xce --quiet
7
7
  ```
8
8
 
9
9
  Agora você pode começar a resolver os exercícios!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-python-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.2
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-22 00:00:00.000000000 Z
11
+ date: 2023-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit
@@ -30,20 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '6.0'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 6.0.8
33
+ version: '6.10'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '6.0'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 6.0.8
40
+ version: '6.10'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: bundler
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -182,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
176
  - !ruby/object:Gem::Version
183
177
  version: '0'
184
178
  requirements: []
185
- rubygems_version: 3.0.3
179
+ rubygems_version: 3.1.6
186
180
  signing_key:
187
181
  specification_version: 4
188
182
  summary: Python Runner for Mumuki