From 331b364232bd3a7e79de1ba31ee25424677467f6 Mon Sep 17 00:00:00 2001 From: Justin Duch Date: Tue, 9 Jan 2024 15:49:52 +1100 Subject: [PATCH] fix test running --- .github/workflows/rust.yml | 8 ++++---- src/lib.rs | 12 ++++++------ src/models/subreddit/mod.rs | 10 ++++------ src/models/user/mod.rs | 6 ++---- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e365cc2..8f22d3b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -28,8 +28,8 @@ jobs: override: true default: true - - name: Build - run: cargo build --verbose + - name: Run async tests + run: cargo test - - name: Run tests - run: cargo test --all-features --verbose + - name: Run blocking tests + run: cargo test --features=blocking diff --git a/src/lib.rs b/src/lib.rs index 990f5bd..7560942 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,10 +7,10 @@ //! To create an OAuth client with the reddit API, use the `Reddit` class. //! ```no_run //! use roux::Reddit; -//! #[cfg(feature = "async")] +//! #[cfg(not(feature = "blocking"))] //! use tokio; //! -//! #[cfg_attr(feature = "async", tokio::main)] +//! #[cfg_attr(not(feature = "blocking"), tokio::main)] //! #[maybe_async::maybe_async] //! async fn main() { //! let client = Reddit::new("USER_AGENT", "CLIENT_ID", "CLIENT_SECRET") @@ -34,10 +34,10 @@ //! ### Submit A Text Post //! ```no_run //! use roux::Reddit; -//! #[cfg(feature = "async")] +//! #[cfg(not(feature = "blocking"))] //! use tokio; //! -//! #[cfg_attr(feature = "async", tokio::main)] +//! #[cfg_attr(not(feature = "blocking"), tokio::main)] //! #[maybe_async::maybe_async] //! async fn main() { //! let client = Reddit::new("USER_AGENT", "CLIENT_ID", "CLIENT_SECRET") @@ -54,10 +54,10 @@ //! ### Submit A Link Post //! ```no_run //! use roux::Reddit; -//! #[cfg(feature = "async")] +//! #[cfg(not(feature = "blocking"))] //! use tokio; //! -//! #[cfg_attr(feature = "async", tokio::main)] +//! #[cfg_attr(not(feature = "blocking"), tokio::main)] //! #[maybe_async::maybe_async] //! async fn main() { //! let client = Reddit::new("USER_AGENT", "CLIENT_ID", "CLIENT_SECRET") diff --git a/src/models/subreddit/mod.rs b/src/models/subreddit/mod.rs index 834dfa8..d23669a 100644 --- a/src/models/subreddit/mod.rs +++ b/src/models/subreddit/mod.rs @@ -4,10 +4,10 @@ //! # Basic Usage //! ```no_run //! use roux::Subreddit; -//! #[cfg(feature = "async")] +//! #[cfg(not(feature = "blocking"))] //! use tokio; //! -//! #[cfg_attr(feature = "async", tokio::main)] +//! #[cfg_attr(not(feature = "blocking"), tokio::main)] //! #[maybe_async::maybe_async] //! async fn main() { //! let subreddit = Subreddit::new("rust"); @@ -40,10 +40,10 @@ //! ```no_run //! use roux::Subreddit; //! use roux::util::{FeedOption, TimePeriod}; -//! #[cfg(feature = "async")] +//! #[cfg(not(feature = "blocking"))] //! use tokio; //! -//! #[cfg_attr(feature = "async", tokio::main)] +//! #[cfg_attr(not(feature = "blocking"), tokio::main)] //! #[maybe_async::maybe_async] //! async fn main() { //! let subreddit = Subreddit::new("astolfo"); @@ -295,8 +295,6 @@ mod tests { use super::Subreddit; use super::Subreddits; - // TODO: fix this in gha - // #[maybe_async::test(feature = "blocking", async(not(feature = "blocking"), tokio::test))] #[maybe_async::async_impl] #[tokio::test] async fn test_no_auth() { diff --git a/src/models/user/mod.rs b/src/models/user/mod.rs index 7615347..52eea75 100644 --- a/src/models/user/mod.rs +++ b/src/models/user/mod.rs @@ -5,10 +5,10 @@ //! ```no_run //! use roux::User; //! use roux::util::FeedOption; -//! #[cfg(feature = "async")] +//! #[cfg(not(feature = "blocking"))] //! use tokio; //! -//! #[cfg_attr(feature = "async", tokio::main)] +//! #[cfg_attr(not(feature = "blocking"), tokio::main)] //! #[maybe_async::maybe_async] //! async fn main() { //! let user = User::new("kasuporo"); @@ -127,8 +127,6 @@ mod tests { use super::User; use crate::util::FeedOption; - // TODO: fix this in gha - // #[maybe_async::test(feature = "blocking", async(not(feature = "blocking"), tokio::test))] #[maybe_async::async_impl] #[tokio::test] async fn test_no_auth() {