diff options
author | Sven-Hendrik Haase <svenstaro@gmail.com> | 2019-05-01 07:13:13 +0000 |
---|---|---|
committer | Sven-Hendrik Haase <svenstaro@gmail.com> | 2019-05-01 07:13:13 +0000 |
commit | 1adab9d2f5d7863b6df32992ecb21dcea5b51d21 (patch) | |
tree | 2eda7658c659bb25c3e412b7c2d03d89b0226aa8 /tests/fixtures | |
parent | Merge pull request #91 from KSXGitHub/split-integration-test (diff) | |
download | miniserve-1adab9d2f5d7863b6df32992ecb21dcea5b51d21.tar.gz miniserve-1adab9d2f5d7863b6df32992ecb21dcea5b51d21.zip |
Make tests into their own proper modules without star imports
Star imports make it hard to see which imports a module is actually using so I prefer to have this be a bit more explicit.
Diffstat (limited to 'tests/fixtures')
-rw-r--r-- | tests/fixtures/mod.rs | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/tests/fixtures/mod.rs b/tests/fixtures/mod.rs index d074cb0..9cfd2cf 100644 --- a/tests/fixtures/mod.rs +++ b/tests/fixtures/mod.rs @@ -1,27 +1,18 @@ -#![allow(dead_code)] - -pub use assert_cmd::prelude::*; -pub use assert_fs::fixture::TempDir; -pub use assert_fs::prelude::*; -pub use clap::{crate_name, crate_version}; -pub use port_check::free_local_port; -pub use reqwest; -pub use reqwest::multipart; -pub use rstest::rstest; -pub use select::document::Document; -pub use select::predicate::{Attr, Text}; -pub use std::process::{Command, Stdio}; -pub use std::thread::sleep; -pub use std::time::Duration; -pub use rstest::rstest_parametrize; +use assert_fs::fixture::TempDir; +use assert_fs::prelude::*; +use port_check::free_local_port; +use rstest::fixture; /// Error type used by tests pub type Error = Box<std::error::Error>; /// File names for testing purpose +#[allow(dead_code)] pub static FILES: &[&str] = &["test.txt", "test.html", "test.mkv"]; /// Test fixture which creates a temporary directory with a few files inside. +#[fixture] +#[allow(dead_code)] pub fn tmpdir() -> TempDir { let tmpdir = assert_fs::TempDir::new().expect("Couldn't create a temp dir for tests"); for &file in FILES { @@ -34,6 +25,8 @@ pub fn tmpdir() -> TempDir { } /// Get a free port. +#[fixture] +#[allow(dead_code)] pub fn port() -> u16 { free_local_port().expect("Couldn't find a free local port") } |