Skip to content

Commit

Permalink
flaky tests are not flaky, will pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ndmanvar committed Dec 18, 2024
1 parent a2b5b1a commit e5ad833
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flask/src/test/test_flaky.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class FlakyTestExample(unittest.TestCase):
def test_flaky_function(self):
# Simulating a function that sometimes fails
result = random.choice([True, True, False, False])
result = random.choice([True, True, True, True])

# Adding delay to simulate randomness further
time.sleep(random.uniform(0.1, 0.5))
Expand Down
2 changes: 1 addition & 1 deletion react/src/tests/Flaky.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe("Flaky Test Example", () => {
test("sometimes passes, sometimes fails", () => {
// Simulating a function that sometimes returns true and sometimes false
const result = Math.random() > 0.25;
const result = Math.random() > 0.0;

// Adding a small delay to make it even flakier
return new Promise((resolve) => {
Expand Down

0 comments on commit e5ad833

Please sign in to comment.