Skip to content

Commit

Permalink
Remove test_fixtures dependency
Browse files Browse the repository at this point in the history
This was preventing us from publishing to crates.io.

The test_fixtures directory was moved into a test project. The tests
that use those fixtures now change directory during the test. This is a
problem for other tests which expect to be in the normal directory or at
least not change mid test. To deal with that, and to prevent developers
from needing to run tests with RUST_TEST_THREADS=1, each test takes a
shared lock to synchronize them. In an ideal world, the test threads
flag would just be an option in Cargo.toml, or something like
rust-lang/rust#33519 would exist.
  • Loading branch information
jwilm committed Dec 23, 2016
1 parent 91c24d0 commit 1f0f942
Show file tree
Hide file tree
Showing 10 changed files with 274 additions and 17 deletions.
12 changes: 7 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ version = "0.0.103"
optional = true

[dev-dependencies]
test_fixtures = { path = "src/test_fixtures" }
rand = "0.3"
lazy_static = "0.2"

[features]
nightly = []
2 changes: 1 addition & 1 deletion src/racer/nameres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ pub fn get_crate_file(name: &str, from_path: &Path, session: &Session) -> Option
return Some(p);
}

let srcpaths = std::env::var("RUST_SRC_PATH").unwrap();
let srcpaths = std::env::var("RUST_SRC_PATH").expect("RUST_SRC_PATH is set");
let v = srcpaths.split(PATH_SEP).collect::<Vec<_>>();
for srcpath in v.into_iter() {
{
Expand Down
7 changes: 7 additions & 0 deletions src/test_project/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "test_project"
version = "0.1.0"
authors = ["Joe Wilm <joe@jwilm.com>"]

[dependencies]
test_fixtures = { path = "./test_fixtures" }
6 changes: 6 additions & 0 deletions src/test_project/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 1f0f942

Please sign in to comment.