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 flaky tests in test_bash #75

Open
pengyunie opened this issue May 24, 2023 · 0 comments
Open

fix flaky tests in test_bash #75

pengyunie opened this issue May 24, 2023 · 0 comments

Comments

@pengyunie
Copy link
Owner

def test_issue67_pass(tmp_path: Path):
temp_script = tmp_path / "z.sh"
su.io.dump(
temp_script,
"""#!/bin/bash
echo > z.txt
sleep 0.2
echo "done" >> z.txt""",
fmt=su.io.fmts.txt,
)
temp_script.chmod(0o755)
with su.io.cd(tmp_path):
with pytest.raises(su.bash.TimeoutExpired):
su.bash.run("./z.sh", timeout=0.1)
time.sleep(0.2)
assert "done" not in su.io.load("z.txt")
def test_issue67_fail1(tmp_path: Path):
temp_script = tmp_path / "z.sh"
su.io.dump(
temp_script,
"""#!/bin/bash
echo > z.txt
sleep 0.2
echo "done" >> z.txt""",
fmt=su.io.fmts.txt,
)
temp_script.chmod(0o755)
with su.io.cd(tmp_path):
with pytest.raises(su.bash.TimeoutExpired):
su.bash.run("./z.sh > a.txt", timeout=0.1)
time.sleep(0.2)
assert "done" not in su.io.load("z.txt")
def test_issue67_fail2(tmp_path: Path):
temp_script = tmp_path / "z.sh"
su.io.dump(
temp_script,
"""#!/bin/bash
echo > z.txt
sleep 0.2
echo "done" >> z.txt""",
fmt=su.io.fmts.txt,
)
temp_script.chmod(0o755)
with su.io.cd(tmp_path):
with pytest.raises(su.bash.TimeoutExpired):
su.bash.run("./z.sh 2>&1", timeout=0.1)
time.sleep(0.2)
assert "done" not in su.io.load("z.txt")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant