Skip to content

Commit 1f0f942

Browse files
committed
Remove test_fixtures dependency
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.
1 parent 91c24d0 commit 1f0f942

File tree

10 files changed

+274
-17
lines changed

10 files changed

+274
-17
lines changed

Cargo.lock

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ version = "0.0.103"
3434
optional = true
3535

3636
[dev-dependencies]
37-
test_fixtures = { path = "src/test_fixtures" }
3837
rand = "0.3"
38+
lazy_static = "0.2"
3939

4040
[features]
4141
nightly = []

src/racer/nameres.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ pub fn get_crate_file(name: &str, from_path: &Path, session: &Session) -> Option
714714
return Some(p);
715715
}
716716

717-
let srcpaths = std::env::var("RUST_SRC_PATH").unwrap();
717+
let srcpaths = std::env::var("RUST_SRC_PATH").expect("RUST_SRC_PATH is set");
718718
let v = srcpaths.split(PATH_SEP).collect::<Vec<_>>();
719719
for srcpath in v.into_iter() {
720720
{

src/test_project/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "test_project"
3+
version = "0.1.0"
4+
authors = ["Joe Wilm <[email protected]>"]
5+
6+
[dependencies]
7+
test_fixtures = { path = "./test_fixtures" }

src/test_project/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#[cfg(test)]
2+
mod tests {
3+
#[test]
4+
fn it_works() {
5+
}
6+
}

0 commit comments

Comments
 (0)