games-util/protonup-rs: use CARGO_SKIP_TESTS instead of PATCHES

previous versions was patching the source code to manually rip out the
code related to online tests

these versions use CARGO_SKIP_TESTS instead, making the process much
easier to maintain, test, bump, and, if need arises, easier to
re-enable/disable patches again

Signed-off-by: ingenarel (NeoJesus) <ingenarel_neojesus@disroot.org>
This commit is contained in:
ingenarel (NeoJesus)
2026-05-07 13:22:29 +06:00
parent dd206b5af0
commit 275500944b
4 changed files with 20 additions and 192 deletions

View File

@@ -1,93 +0,0 @@
diff --git a/libprotonup/src/downloads.rs b/libprotonup/src/downloads.rs
index 20f618b..1580f7e 100644
--- a/libprotonup/src/downloads.rs
+++ b/libprotonup/src/downloads.rs
@@ -280,87 +280,10 @@ impl Download {
mod tests {
use std::str::FromStr;
- use crate::{constants, sources};
+ use crate::sources;
use super::*;
- #[tokio::test]
- async fn test_list_releases() {
- let conditions = &[
- (
- sources::CompatTool::from_str(constants::DEFAULT_LUTRIS_TOOL).unwrap(),
- "Get WineGE",
- ),
- (
- sources::CompatTool::from_str(constants::DEFAULT_STEAM_TOOL).unwrap(),
- "Get GEProton",
- ),
- (
- sources::CompatTool::from_str("Luxtorpeda").unwrap(),
- "Get Luxtorpeda",
- ),
- ];
-
- for (source_parameters, desc) in conditions {
- let result = list_releases(source_parameters).await;
-
- assert!(
- result.is_ok(),
- "case : '{desc}' test: list_releases returned error"
- );
-
- let result = result.unwrap();
-
- assert!(
- result.len() > 1,
- "case : '{desc}' test: test_list_releases returned an empty list"
- );
- }
- }
-
- #[tokio::test]
- async fn test_get_release() {
- let agent = format!("{}/v{}", constants::USER_AGENT, constants::VERSION,);
-
- let client = match reqwest::Client::builder().user_agent(agent).build() {
- Ok(client) => client,
- Err(e) => {
- eprintln!("Error: {e}");
- std::process::exit(1)
- }
- };
-
- let conditions = &[
- (
- sources::CompatTool::from_str(constants::DEFAULT_LUTRIS_TOOL).unwrap(),
- "Get WineGE",
- ),
- (
- sources::CompatTool::from_str(constants::DEFAULT_STEAM_TOOL).unwrap(),
- "Get GEProton",
- ),
- ];
- for (source_parameters, desc) in conditions {
- let url = format!(
- "{}/{}/{}/releases/latest",
- source_parameters.forge.get_url(),
- source_parameters.repository_account,
- source_parameters.repository_name
- );
-
- let rel = match client.get(url).send().await {
- Ok(res) => res,
- Err(e) => {
- panic!("Error: {e}");
- }
- }
- .json::<Release>()
- .await;
-
- assert!(rel.is_ok(), "case : '{desc}' test: test_get_release wrong");
- }
- }
-
#[tokio::test]
async fn test_get_download_name() {
let empty = "".to_owned();

View File

@@ -1,93 +0,0 @@
diff --git a/libprotonup/src/downloads.rs b/libprotonup/src/downloads.rs
index 6cfc3e6..de4f460 100644
--- a/libprotonup/src/downloads.rs
+++ b/libprotonup/src/downloads.rs
@@ -280,87 +280,10 @@ impl Download {
mod tests {
use std::str::FromStr;
- use crate::{constants, sources};
+ use crate::sources;
use super::*;
- #[tokio::test]
- async fn test_list_releases() {
- let conditions = &[
- (
- sources::CompatTool::from_str(constants::DEFAULT_LUTRIS_TOOL).unwrap(),
- "Get GEProton",
- ),
- (
- sources::CompatTool::from_str(constants::DEFAULT_STEAM_TOOL).unwrap(),
- "Get GEProton",
- ),
- (
- sources::CompatTool::from_str("Luxtorpeda").unwrap(),
- "Get Luxtorpeda",
- ),
- ];
-
- for (source_parameters, desc) in conditions {
- let result = list_releases(source_parameters).await;
-
- assert!(
- result.is_ok(),
- "case : '{desc}' test: list_releases returned error"
- );
-
- let result = result.unwrap();
-
- assert!(
- result.len() > 1,
- "case : '{desc}' test: test_list_releases returned an empty list"
- );
- }
- }
-
- #[tokio::test]
- async fn test_get_release() {
- let agent = format!("{}/v{}", constants::USER_AGENT, constants::VERSION,);
-
- let client = match reqwest::Client::builder().user_agent(agent).build() {
- Ok(client) => client,
- Err(e) => {
- eprintln!("Error: {e}");
- std::process::exit(1)
- }
- };
-
- let conditions = &[
- (
- sources::CompatTool::from_str(constants::DEFAULT_LUTRIS_TOOL).unwrap(),
- "Get GEProton",
- ),
- (
- sources::CompatTool::from_str(constants::DEFAULT_STEAM_TOOL).unwrap(),
- "Get GEProton",
- ),
- ];
- for (source_parameters, desc) in conditions {
- let url = format!(
- "{}/{}/{}/releases/latest",
- source_parameters.forge.get_url(),
- source_parameters.repository_account,
- source_parameters.repository_name
- );
-
- let rel = match client.get(url).send().await {
- Ok(res) => res,
- Err(e) => {
- panic!("Error: {e}");
- }
- }
- .json::<Release>()
- .await;
-
- assert!(rel.is_ok(), "case : '{desc}' test: test_get_release wrong");
- }
- }
-
#[tokio::test]
async fn test_get_download_name() {
let empty = "".to_owned();

View File

@@ -343,8 +343,6 @@ QA_FLAGS_IGNORED="usr/bin/${PN}"
DOCS=( README.md docs )
PATCHES=( "${FILESDIR}/fix-tests-0.10.0.patch" )
# apply-crates-fixes start
src_compile(){
export ZSTD_SYS_USE_PKG_CONFIG=1 # fix for zstd-sys crate
@@ -358,6 +356,15 @@ src_compile(){
# but what it can do is use set the AWS_LC_SYS_CFLAGS var to override CFLAGS
cargo_src_compile
}
src_test(){
local CARGO_SKIP_TESTS=(
'downloads::tests::test_get_release'
'downloads::tests::test_list_releases'
)
cargo_src_test
}
# apply-crates-fixes end
src_install(){
cargo_src_install --path "${S}/${PN}"

View File

@@ -345,8 +345,6 @@ QA_FLAGS_IGNORED="usr/bin/${PN}"
DOCS=( README.md docs )
PATCHES=( "${FILESDIR}/fix-tests-0.12.0.patch" )
# apply-crates-fixes start
src_compile(){
export ZSTD_SYS_USE_PKG_CONFIG=1 # fix for zstd-sys crate
@@ -361,6 +359,15 @@ src_compile(){
cargo_src_compile
}
# apply-crates-fixes end
src_test(){
local CARGO_SKIP_TESTS=(
'downloads::tests::test_get_release'
'downloads::tests::test_list_releases'
)
cargo_src_test
}
src_install(){
cargo_src_install --path "${S}/${PN}"
einstalldocs