Commit graph

115 commits

Author SHA1 Message Date
David Rodríguez
a1492ffdc2 [rubygems/rubygems] Run specs that now pass on JRuby
2af077ee38
2024-10-10 14:51:30 +00:00
tompng
af1c356c7b Update default gem test for colon-style hash inspect 2024-10-03 18:47:09 +09:00
David Rodríguez
d4ac5c573b [rubygems/rubygems] Don't add duplicated specs to unresolved specs
This could happen when a regular gem shadows a default gem.

9ef70dd1f7
2024-09-30 05:07:57 +00:00
Hiroshi SHIBATA
a780633d2a Don't use benchmark for test_activate_via_require_respects_loaded_files
benchmark.rb may extract as bundled gems in the future release
2024-08-29 17:37:44 +09:00
David Rodríguez
5c573b7652 [rubygems/rubygems] Fix default gem priority when sorting specs
8dbe1dbdc7

Co-authored-by: MSP-Greg <Greg.mpls@gmail.com>
2024-06-13 14:25:14 +00:00
Stan Hu
67b00f721d Make tests play with upstream Ruby tests
CI broke in https://github.com/ruby/ruby/pull/9604 because if any Ruby
tests run `require 'net/http'`, they will pollute the
`$LOADED_FEATURES` for the RubyGems tests. We can fix this by renaming
the test default gem from `net-http` to `my-http`.

See https://github.com/rubygems/rubygems/pull/7379#issuecomment-1901241299
for more details.
2024-01-22 09:57:10 +09:00
Hiroshi SHIBATA
00dc1cace8 Reapply "[rubygems/rubygems] Fix activation conflicts when circularly requiring a gem"
This reverts commit 04cf66765a.
2024-01-22 09:57:10 +09:00
Hiroshi SHIBATA
d51f4c9288 Reapply "[rubygems/rubygems] Fix require of a default gem when unresolved gems depend on it"
This reverts commit 54552b89e7.
2024-01-22 09:57:10 +09:00
Hiroshi SHIBATA
54552b89e7
Revert "[rubygems/rubygems] Fix require of a default gem when unresolved gems depend on it"
This reverts commit f1f5f22d22.
2024-01-19 12:12:33 +09:00
Hiroshi SHIBATA
04cf66765a
Revert "[rubygems/rubygems] Fix activation conflicts when circularly requiring a gem"
This reverts commit db44088c2a.

  2064164082
  2064164121
  2064164203
2024-01-19 11:54:17 +09:00
David Rodríguez
db44088c2a [rubygems/rubygems] Fix activation conflicts when circularly requiring a gem
If a gem is required circular, and there are unresolved specs depending
on it, we may end up in an activation conflict.

The solution is to not try to activate unresolved gems when requiring a
default gem, regardless of it having already been activated or not.

3b2b8f4e3e
2024-01-19 11:28:11 +09:00
David Rodríguez
f1f5f22d22 [rubygems/rubygems] Fix require of a default gem when unresolved gems depend on it
The following conditions must be met:

* A default gem is required.
* A previous require left some gems unresolved, and those dependencies
  themselves depend on the default gem.

In this case, rubygems require will first activate the default version
of the gem, then try to activate another unresolved version of the
default gem that conflicts with the first activation.

The solution is, if we are in the middle of requiring a default gem,
skip this step, because we have already activated it successfully.

8cd5608db5

Co-authored-by: Stan Hu <stanhu@gmail.com>
2024-01-19 11:28:11 +09:00
David Rodríguez
4e47671073
[rubygems/rubygems] Test that regular gems don't shadow default gems
b8ca5950a6
2024-01-19 10:49:12 +09:00
Vít Ondruch
28f7a46f44 [rubygems/rubygems] Provide more insightful test error output
Original output:

~~~
Failure: test_realworld_upgraded_default_gem(TestGemRequire): <false> is not true.
/mnt/test/rubygems/test_require.rb:474:in `test_realworld_upgraded_default_gem'
     471:     File.write(path, code)
     472:
     473:     output = Gem::Util.popen({ "GEM_HOME" => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip
  => 474:     assert $?.success?
     475:     refute_empty output
     476:     assert_equal "999.99.9", output.lines[0].chomp
     477:     # Make sure only files from the newer json gem are loaded, and no files from the default json gem
~~~

New output:

~~~
Failure: test_realworld_upgraded_default_gem(TestGemRequire)
/mnt/test/rubygems/test_require.rb:475:in `test_realworld_upgraded_default_gem'
     472:
     473:     output = Gem::Util.popen({ "GEM_HOME" => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip
     474:     refute_empty output
  => 475:     assert_equal "999.99.9", output.lines[0].chomp
     476:     # Make sure only files from the newer json gem are loaded, and no files from the default json gem
     477:     assert_equal ["#{@gemhome}/gems/json-999.99.9/lib/json.rb"], output.lines.grep(%r{/gems/json-}).map(&:chomp)
     478:     assert $?.success?
<"999.99.9"> expected but was
<"/mnt/tmp/test_rubygems_20231110-36663-of405r/test_realworld_upgraded_default_gem.rb:3:in `<main>': undefined method `version' for nil:NilClass (NoMethodError)">

diff:
? 999                                                                             .99.9
? /mnt/tmp/test_rubygems_20231110-36663-of405r/test_realworld_upgraded_default_gem rb:3:in `<main>': undefined method `version' for nil:NilClass (NoMethodError)
? ??? ????
~~~

It is more valuable to check the command output then the error code. If
the command fails for some reason, the output probably contains some
detail, while checking the return code tells not much.

b76062e852
2023-11-13 11:06:10 +09:00
Hiroshi SHIBATA
cbeea5f3e6 [rubygems/rubygems] Unify java_platform? to Gem.java_platform?
7f27ab32b8
2023-04-05 05:49:24 +00:00
Hiroshi SHIBATA
f24a86d83f util/rubocop -A --only Layout/EmptyLineAfterMagicComment 2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
72d09a568f [rubygems/rubygems] util/rubocop -A --only Style/RedundantBegin
b595d3cf0f
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
03b82d1865 [rubygems/rubygems] util/rubocop -A --only Style/SingleLineMethods
fa2e835ed2
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
712d6e675b [rubygems/rubygems] util/rubocop -A --only Style/RedundantInterpolation
add44e56eb
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
567db6064b [rubygems/rubygems] util/rubocop -A --only Style/NestedParenthesizedCalls
a875fdb535
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
83f9aa8f02 [rubygems/rubygems] util/rubocop -A --only Style/Alias
fba6e94de9
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
05208c3875 [rubygems/rubygems] util/rubocop -A --only Lint/UnusedBlockArgument
d8efd919db
2023-03-17 18:50:55 +09:00
Nobuyoshi Nakada
53cd5796c5 [rubygems/rubygems] Clean test output
The output from the command is mixed in this test, even when
successful.
Use the output as a part of the message on failure instead.

960509a133
2023-01-20 10:39:57 +00:00
Hiroshi SHIBATA
f6620037ba Merge RubyGems-3.4.0 and Bundler-2.4.0 2022-12-24 16:57:07 +09:00
David Rodríguez
9d10b8393e [rubygems/rubygems] Use better name for variable
The installed file not always have the `.so` extension.

6f6681bcb9

Co-authored-by: Eloy Espinaco <eloyesp@gmail.com>
2022-12-20 13:15:02 +09:00
Eloy Espinaco
012ef7d1d0 [rubygems/rubygems] Fix tests checking intermediate files
Some tests check that the shared objects are actually installed, but
checking an intermediate build file instead of the installed one.

ad526073b0
2022-12-20 13:15:02 +09:00
Hiroshi SHIBATA
bbe56a6437 Merge RubyGems/Bundler master
from bfb0ae6977
2022-12-12 10:49:43 +09:00
David Rodríguez
20eff52087 [rubygems/rubygems] Test a pure RubyGems method
`Gem::Specification#load_paths` is actually a Bundler thing.

d20b4d1950
2022-09-29 03:41:52 +09:00
Hiroshi SHIBATA
44264b4fee Merge rubygems/bundler HEAD.
Pick from dfbb5a3811
2022-08-09 12:05:19 +09:00
Takuya Noguchi
d7ffd3fea4
RubyGems: Enable Style/StringLiterals cop
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-07-22 12:07:23 +09:00
David Rodríguez
12a5fa408b Sync RubyGems & Bundler with upstream repo 2022-06-24 10:52:02 +09:00
Hiroshi SHIBATA
aeea88174d
Merge RubyGems and Bundler HEAD
125415593e
2022-05-20 17:32:19 +09:00
Hiroshi SHIBATA
d77b88c681 Move testing_ruby_repo into test helper 2022-04-28 19:08:49 +09:00
Hiroshi SHIBATA
678d58c850 Merge rubygems master 1e4eda741d732ca1bd7031aef0a16c7348adf7a5 2022-04-28 19:08:49 +09:00
Hiroshi SHIBATA
fb1ab27f53 Merge RubyGems-3.3.1 and Bundler-2.3.1 2021-12-23 09:44:45 +09:00
David Rodríguez
890a6b432c [rubygems/rubygems] Unify duplicated helper
c6ef75424d
2021-12-15 19:46:43 +09:00
David Rodríguez
e713552868 [rubygems/rubygems] LOAD_PATH is already reset globally
b0bbb27115
2021-12-06 05:25:22 +09:00
David Rodríguez
2fc47bad78 [rubygems/rubygems] Remove unneded setup
9815a04e31
2021-12-06 05:25:21 +09:00
Hiroshi SHIBATA
0b53a8895f
Merge rubygems master fd676ac464491afaa0baf5435cb11b3f86229cbd 2021-12-01 11:00:10 +09:00
David Rodríguez
6e2240a2f9 Sync latest bundler & rubygems development version 2021-07-07 13:30:20 +09:00
Yusuke Endoh
b957c3dbcb [rubygems/rubygems] Rename test/rubygems/test_{case,utilities}.rb to avoid "test_" prefix
This changes "test/rubygems/test_case.rb" to "test/rubygems/helper.rb",
and "test/rubygems/test_utilities.rb" to "test/rubygems/utilities.rb".

The two files are a helper for tests, not test files. However, a file
starting with "test_" prefix is handled as a test file directly loaded
by test-unit because Rakefile specifies:

```
t.test_files = FileList['test/**/test_*.rb']
```

Directly loading test/rubygems/test_utilities.rb caused "uninitialized
constant Gem::TestCase". This issue was fixed by
59c6820971, but the fix caused a
"circular require" warning because test_utilities.rb and test_case.rb
are now requiring each other.

Anyway, adding "test_" prefix to a test helper file is confusing, so
this changeset reverts the fix and solve the issue by renaming them.

6460e018df
2021-06-03 12:23:22 +09:00
Hiroshi SHIBATA
e487ba7dda
[rubygems/rubygems] Use pend instead of skip 2021-05-28 12:33:16 +09:00
David Rodríguez
f7732ae2eb [rubygems/rubygems] Require the new files in test/ relatively
c77868a555
2021-05-28 11:53:09 +09:00
Hiroshi SHIBATA
c30594bb0c [rubygems/rubygems] Use assert_raise instead of assert_raises
769e87f011
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
3948be3503 [rubygems/rubygems] Use assert_path_exist and assert_path_not_exist instead of assert_path_exists and refute_path_exists
a7c93558c3
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
4aca77edde Merge prepare version of RubyGems 3.2.0 2020-12-08 17:30:02 +09:00
Hiroshi SHIBATA
b717f73402
Revert "Manually merged from https://github.com/rubygems/rubygems/pull/2636"
31a6eaabc1 is obsoleted with
  https://github.com/rubygems/rubygems/pull/3820
2020-09-23 22:01:44 +09:00
Hiroshi SHIBATA
31a6eaabc1
Manually merged from https://github.com/rubygems/rubygems/pull/2636
Enable Style/EmptyLinesAroundClassBody rubocop cop.
2020-09-23 21:02:56 +09:00
David Rodríguez
a89665b7b1 Enforce no empty lines around class body in rubygems
To normalize the code style with `bundler`.
2020-07-31 21:07:19 +09:00
David Rodríguez
955f1837a1 Use space inside block braces everywhere
To make rubygems code style consistent with bundler.
2020-06-15 21:20:37 +09:00