Commit Graph

82 Commits

Author SHA1 Message Date
Scott Schafer 251a2c7915 cargo-test-support: Make publish http api write to file system 2022-09-22 10:00:49 -06:00
Wim Looman 492358a19f
Only override published resolver when the workspace is different 2022-08-10 09:26:50 +02:00
Wim Looman d953c3b2d7
Override to resolver=1 in published package 2022-07-29 16:03:05 +02:00
Arlo Siemsen 24dac452c5 Improve testing framework for http registries
Improve integration of the http server introduced by the http-registry feature.
Now the same HTTP server is used for serving downloads, the index, and
the API.

This makes it easier to write tests that deal with authentication and
http registries.
2022-06-10 16:51:35 -05:00
likzn b486ada19f clean err msg 2022-05-26 08:49:06 +08:00
likzn 52165e8c2d update 2022-05-25 18:17:08 +08:00
likzn 72d6c5411a cargo fmt 2022-05-24 09:15:44 +08:00
likzn 72457ef462 fix test stderr 2022-05-24 09:09:57 +08:00
likzn 1179e7ef6b cargo fmt 2022-05-23 21:06:34 +08:00
likzn 89c24bf811 refactor logic 2022-05-23 21:01:55 +08:00
likzn a5a0f6809d fix typo 2022-05-18 23:42:42 +08:00
likzn 95cb21d6a1 fix cargo -p 2022-05-18 22:40:55 +08:00
Ed Page 0f75237617 test: Fix compatibilty with new toml_edit
`toml_edit` fixed a bug in 0.13.4 that this test was relying on that is
meant to help with rust-lang/cargo#10349.  This basically restores us
back to the pre-toml_edit behavior for published manifests.
2022-01-31 10:57:38 -06:00
Ed Page 320c279f43 Port cargo from toml-rs to toml_edit
Benefits:
- A TOML 1.0 compliant parser
- Unblock future work
  - Have `cargo init` add the current crate to the workspace, rather
    than error
  - #5586: Upstream `cargo-add`
2022-01-13 09:27:27 -06:00
l00556901 cf621fdc94 modify test 2021-12-02 19:55:56 +08:00
l00556901 64c69dffc5 fix some bugs 2021-12-01 11:21:06 +08:00
l00556901 56b8ae7c44 delete --host command and message 2021-12-01 10:29:46 +08:00
Eric Huss 30ff8424c9 Remove unnecessary format! 2021-07-26 12:56:53 -07:00
tcmal 8f1f0e40fd feat(package+publish): package arguments
adds -p, --workspace, and --exclude to package command,
and -p to publish command, as well as tests for both.

closes #7345
2021-07-26 16:31:58 +01:00
Weihang Lo 8c75e2ffa0
Update tests to use registry names 2021-07-22 00:50:30 +08:00
Eric Huss b73e3d4fa5 Don't export lines_match.
Use better high-level interfaces to achieve the same thing.
2021-06-16 09:44:29 -07:00
Eric Huss c9bd6e12e1 Minor update to registry API error messages. 2021-02-27 12:38:17 -08:00
Eric Huss 06b8d1cac1 Add a ResponseError for registry API interaction.
The intent here is to make it easier to work with API errors.

This also includes some new tests for checking network errors.
2021-02-02 17:44:57 -08:00
Eric Huss 340656e29d Add RegistryBuilder to help initializing test registries.
The intent here is to make it more flexible to create different registry
setups, and to reuse code a little more easily.
2021-02-02 15:48:48 -08:00
Eric Huss 6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Nazım Can Altınova 32449a70db
Add a test case for new publish behavior change 2020-08-06 13:01:15 +02:00
Eric Huss 7a5f0369cb Fix failure with missing readme. 2020-06-11 14:55:33 -07:00
Eric Huss 65274ea7d5 Add a warning when using `registry.token` with source replacement. 2020-04-19 09:25:32 -07:00
Eric Huss b4c374039f Do not implicitly load registry.token with --index.
The intent is to avoid leaking the crates.io token to other servers.
2020-04-19 09:20:54 -07:00
Eric Huss 4ae79d2ffd Use fs helpers instead of File functions. 2020-04-17 07:56:16 -07:00
Eric Huss 944f5049f1 Re-implement proc-macro feature decoupling. 2020-03-22 15:08:02 -07:00
Eric Huss 5a1862cd36 Add proc-macro to the index. 2020-03-15 10:10:25 -07:00
Takayuki Nakata 8076f578a3 Refactoring of creating files in tests
Use `mkdir_p` and `fs::write`.
2020-01-14 16:15:29 +09:00
Takayuki Nakata 4b70f14903 Load credentials only when needed
Credentials are always loaded, even if these are not used. If
access to confidential files such as credentials is not given,
`cargo build` fails despite not using credentials.

Fixes #7624.
2020-01-07 23:40:58 +09:00
Matthias Krüger 34f2d4710b fix a couple of typos 2019-12-11 15:31:26 +01:00
Eric Huss 83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Alex Crichton 366ae3f7ba Turn the new lock file format on by default
This commit enables the support added in #7070 by default. This means
that gradually over time all `Cargo.lock` files will be migrated to the
new format. Cargo shipped with Rust 1.38.0 supports this new lock file
format, so any project using Rust 1.38.0 or above will converge quickly
onto the new lock file format and continue working.

The main benefit of the new format is to be more friendly to git merge
conflicts. Information is deduplicated throughout the lock file to avoid
verbose `depedencies` lists and the `checksum` data is all listed inline
with `[[package]]`. This has been deployed with rust-lang/rust for some
time now and it subjectively at least seems to have greatly reduced the
amount of bouncing that happens for touching `Cargo.lock`.
2019-11-12 07:00:18 -08:00
bors 78ba63019d Auto merge of #7333 - ehuss:allow-dev-dep-path, r=alexcrichton
Allow publishing with dev-dependencies without a version.

This change allows dev-dependencies without a `version` key to be published.  If a dev-dependency is missing the `version`, it will be stripped from the packaged manifest.
2019-10-15 14:38:29 +00:00
Alex Crichton 9115b2c326 Extract `support` directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Eric Huss e4345b2e8e Validate uploaded Cargo.toml contents. 2019-09-10 17:06:32 -07:00
Eric Huss d709c10d35 Allow publishing with dev-dependencies without a version. 2019-09-05 14:56:21 -07:00
Eric Huss d682439b71 Allow git+version dependency to be published. 2019-08-19 09:37:52 -07:00
Eric Huss cce87428c0 Improve error message when using API command with non-remote registry. 2019-08-11 18:58:52 -07:00
Sekhat Temporus 69226ed887 improve uncommitted changes cargo-package message
fixes #7003

Explicitly state what the suggested flag `--allow-dirty`
actually does when packaging/publishing the crate. Primarily,
that the uncommited changes are included within the resulting
package.
2019-07-01 18:48:59 +01:00
Eric Huss 34307c6122 Stabilize publish-lockfile. 2019-06-10 13:19:18 -07:00
Jethro Beekman 0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Alex Helfet f7c424f362 Add check token before verify tests. 2019-04-16 17:52:07 +01:00
Eric Huss bf23a7e430 Improve error message for `publish` key restriction.
The existing error message didn't really recognize that `publish` can be a
list.

This also adds support for `publish = ["crates-io"]` to restrict publishing
to crates.io only.
2019-04-11 11:44:26 -07:00
Eric Huss e7124ba262 Testsuite: Make `cwd()` relative to project root.
It's a fairly common pattern, and it seemed natural to me.
2019-03-20 16:34:56 -07:00
bors 2e4cfc2b7d Auto merge of #6654 - ehuss:alt-stabilize, r=alexcrichton
Stabilize Alternative Registries

This includes a few minor changes besides stabilizing:
- `cargo search` won't display `crates.io` search URL for extra results for non-crates.io registries.
- Document using environment variables for API tokens.
- Explicit section in `config.md` for documenting the credentials file.

Closes rust-lang/rust#44931
Closes rust-lang/crates-io-cargo-teams#21
Closes #6589
Closes #4688
2019-02-12 19:47:40 +00:00