padded_cell 0.4.0-x86_64-linux-gnu → 0.5.1-x86_64-linux-gnu

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: ebe683991a538645ccc89454dbfac05db37da935176bbc92d253af396dbb1cf1
4
- data.tar.gz: 6ba9ebbc9d3aebd440e6110f468ddd6ecf6e5f9d656f1496bd815460a0299439
3
+ metadata.gz: f701c0b5f37ae17111303cc50111d4f47f6c2a863286ee35ef1799e676da2238
4
+ data.tar.gz: 60591bffbb892b4b0a81bb0abe0a83db838c2397125b1017391ab53ac5868285
5
5
  SHA512:
6
- metadata.gz: 2659b68f32dc9128fa639ec4c4322798259c938e20ed442ed59d5fea2bd3c25f9457b3e018eea2b3c775f5619f7157ab0d9a07975cc6a740dfe6630554b85067
7
- data.tar.gz: 47cc8e205342835bc98956744667dd97a7a67060cf0cebc06722f6b986143fef3caa3a620a60c52541417578a3756091645897bae743233294e2ed40dc150da0
6
+ metadata.gz: fd01eb1f64e4c252604c99510eda89f725c52b95be81ca7bfe2168717283a5157afac6f812ff9b71a535d70c3963e3a32ad7270bc0e01a70477da16f7b6cd7f7
7
+ data.tar.gz: '018306d69064756f600092e50d333990aec1eb7a2c450399b2c58e138a697efff360aea14591583bdedbac945f482978c7ac5fb34edfaf34f127f52509b5fb13'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.1](https://github.com/seuros/padded_cell/compare/v0.5.0...v0.5.1) (2026-11-27)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * resolve spec classes named by their description ([7c065c1](https://github.com/seuros/padded_cell/commit/7c065c121c6059f3b740e658c25136abeac4ff84))
9
+
10
+ ## [0.5.0](https://github.com/seuros/padded_cell/compare/v0.4.0...v0.5.0) (2026-11-27)
11
+
12
+
13
+ ### Features
14
+
15
+ * honor Minitest 6.1's abstract_test_case! ([387ae4f](https://github.com/seuros/padded_cell/commit/387ae4f63d5816caed779fc6dcf667942683c4af))
16
+ * refuse to run after minitest/autorun installed its at_exit ([bd3e81d](https://github.com/seuros/padded_cell/commit/bd3e81d40940fe791f086601e69d1c0f4a7c57e9))
17
+
3
18
  ## 0.4.0 (2026-11-08)
4
19
 
5
20
  - `PADDED_CELL_ASYLUM`: retries failures from the environment. N retries,
data/README.md CHANGED
@@ -42,7 +42,7 @@ down. The other 44 never noticed.
42
42
 
43
43
  ## Installation
44
44
 
45
- Requires CRuby 4.0 or newer and Minitest 6, on Linux, macOS or FreeBSD.
45
+ Requires CRuby 4.0 or newer and Minitest 6.1+, on Linux, macOS or FreeBSD.
46
46
  padded_cell is built on `fork`: Windows, JRuby and TruffleRuby are not
47
47
  supported.
48
48
 
@@ -104,6 +104,12 @@ errors, 3 when only coverage is below a threshold, 130 when interrupted.
104
104
  Loaded tests are the source of truth: inherited, `define_method` and other
105
105
  dynamic tests run even though static discovery cannot see them.
106
106
 
107
+ Minitest 6.1's `abstract_test_case!` is honored: a base class that calls it
108
+ runs its tests only in its subclasses, wherever it is defined (support files
109
+ included). padded_cell reads the call from the class body, so it has to be a
110
+ plain `abstract_test_case!` statement there, not one made from a block, a
111
+ method, an included module or for another class.
112
+
107
113
  ### Isolation
108
114
 
109
115
  `--isolation test` forks a cell per test. Forking a preloaded process is
@@ -20,5 +20,8 @@ module PaddedCell
20
20
  def source(source, file: '(source)') = refs(PaddedCellNative.discover(source), file)
21
21
 
22
22
  def refs(rows, file) = rows.map { TestRef.new(file, *it) }
23
+
24
+ # Names of the classes declared `abstract_test_case!` in files.
25
+ def abstract_classes(files) = PaddedCellNative.abstract_classes(files)
23
26
  end
24
27
  end
@@ -16,6 +16,12 @@ module PaddedCell
16
16
  module_function
17
17
 
18
18
  def call(files, seed:)
19
+ # An at_exit cannot be taken back: refuse rather than run twice.
20
+ if Minitest.installed_at_exit?
21
+ raise LoadFailure, 'minitest/autorun was required before padded_cell loaded the suite: its at_exit ' \
22
+ 'would run every test again, unisolated. Drop it from RUBYOPT, or require ' \
23
+ "'minitest' instead where it runs before padded_cell"
24
+ end
19
25
  Minitest.singleton_class.prepend(NoAutorun)
20
26
  Minitest.seed = seed
21
27
  # What `rake test` and `rails test` put on the load path.
@@ -34,12 +40,36 @@ module PaddedCell
34
40
 
35
41
  # [klass, method_name] for every loaded test, the way Minitest finds them.
36
42
  def tests
37
- Minitest::Runnable.runnables.flat_map do |klass|
43
+ runnables = Minitest::Runnable.runnables
44
+ abstract = abstract_classes(runnables)
45
+ runnables.flat_map do |klass|
46
+ next [] if abstract.include?(klass.name)
47
+
38
48
  klass.runnable_methods.map { [klass, it] }
39
49
  rescue NotImplementedError
40
50
  []
41
51
  end
42
52
  end
53
+
54
+ # Minitest's abstract_test_case! guards the class-level run, which cells
55
+ # never call: the declaration is read from the files the classes were
56
+ # defined in instead, test helpers and support files included.
57
+ def abstract_classes(runnables)
58
+ files = runnables.filter_map { source_file(it) }
59
+ Discovery.abstract_classes(files.uniq.select { File.file?(it) }).to_set
60
+ end
61
+
62
+ CONSTANT_PATH = /\A[A-Z]\w*(::[A-Z]\w*)*\z/
63
+
64
+ # Spec classes are named after their description ("GET #index"), which
65
+ # is no constant: their methods say where they were defined.
66
+ def source_file(klass)
67
+ name = klass.name
68
+ return unless name
69
+ return Object.const_source_location(name)&.first if name.match?(CONSTANT_PATH)
70
+
71
+ klass.instance_methods(false).lazy.filter_map { klass.instance_method(it).source_location&.first }.first
72
+ end
43
73
  end
44
74
 
45
75
  # Which loaded tests run: Minitest's --include/--exclude, plus file:line.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PaddedCell
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padded_cell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: x86_64-linux-gnu
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '6.0'
18
+ version: '6.1'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '6.0'
25
+ version: '6.1'
26
26
  description: Runs existing Minitest and Rails test suites with fork-per-test isolation,
27
27
  crash and timeout containment, seeded timing-aware scheduling and sharding. Discovery
28
28
  and scheduling are a Rust extension, precompiled for Linux, macOS and FreeBSD.