Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixed some flaky tests dues to floating point errors #966

Merged
merged 1 commit into from
Oct 20, 2024

Conversation

coolsidd
Copy link
Contributor

@coolsidd coolsidd commented Oct 20, 2024

Fixed shouldGenerateNearbyGPSCoordinateWithOriginInKilometers and shouldGenerateNearbyGPSCoordinateWithOriginInMiles

Ran all tests locally using the following python script:

import subprocess
from tqdm import tqdm

def run_command(command):
    process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    output, error = process.communicate()
    if process.returncode != 0:
        print(f"Command failed with exit code {process.returncode}:")
        print(error.decode())
        return False
    return output.decode()

def run_command_with_progress_bar(command, iterations):
    for i in tqdm(range(iterations), desc="Running command", unit="iteration"):
        output = run_command(command)
        if output is None:
            break

if __name__ == "__main__":
    command = "ctest"
    iterations = 100
    run_command_with_progress_bar(command, iterations)

The test shouldGenerateSlovakiaStreetAddress is also flaky returning out of bounds errors sometimes.

Fixed test shouldGenerateNearbyGPSCoordinateWithOriginInKilometers
Also fixed shouldGenerateNearbyGPSCoordinateWithOriginInMiles

Ran all tests locally 100 times.
@coolsidd coolsidd changed the title Fix some flaky tests dues to floating point errors fix - Fixed some flaky tests dues to floating point errors Oct 20, 2024
@coolsidd coolsidd changed the title fix - Fixed some flaky tests dues to floating point errors fix: Fixed some flaky tests dues to floating point errors Oct 20, 2024
@coolsidd
Copy link
Contributor Author

This PR fixes #956. This PR was raised for hacktoberfest. If accepted could you please add the corresponding label? Thanks

@cieslarmichal cieslarmichal merged commit a5ae9fa into cieslarmichal:main Oct 20, 2024
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix shouldGenerateNearbyGPSCoordinateWithOriginInKilometers flaky test
2 participants