Skip to content

Speed up slow tests #1892

Closed
Closed

Description

@thomas-zahner

The following slow tests have been bugging me for a while now.

PASS [   7.266s] lychee::cli cli::test_lycheecache_exclude_custom_status_codes
PASS [   7.138s] lychee-lib client::tests::test_timeout
PASS [  12.799s] lychee::cli cli::test_compact_output_format_contains_status
SLOW [> 60.000s] lychee::cli cli::test_url_inputs_always_get_checked_no_matter_their_extension
PASS [ 117.764s] lychee::cli cli::test_url_inputs_always_get_checked_no_matter_their_extension
SLOW [> 60.000s] lychee-lib client::tests::test_require_https

Speed up these tests without changing the functionality of the tests.
Without looking at the code, I assume these tests do network calls.
If this is the case, a solution is to set up local mock servers for testing with wiremock::MockServer to replace external network calls.
For inspiration see

macro_rules! mock_server {

Activity

  1. thomas-zahner commented on Dec 9, 2025

    @thomas-zahner
    MemberAuthor

    Note the following test seems to be flaky. Would be nice to fix in the same PR.

            FAIL [   0.515s] lychee::cli cli::test_lycheecache_file
      stdout ───
    
        running 1 test
        Cache file contents: http://127.0.0.1:38935/,200,1765297468
        http://127.0.0.1:35441/,404,1765297468
    
        test cli::test_lycheecache_file ... FAILED
    
        failures:
    
        failures:
            cli::test_lycheecache_file
    
        test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 134 filtered out; finished in 0.50s
    
      stderr ───
        Error: Failed to remove cache file: "/home/thomas/Projects/lychee/fixtures/cache/.lycheecache", error: No such file or directory (os error 2)
    
  2. added 2 commits that reference this issue on Jan 16, 2026
    8f329fc
    65dd44e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions