Skip to content

Commit

Permalink
Attempt to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexcles committed Dec 19, 2018
1 parent 5680792 commit 3bbb06e
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions tools/wpt/tests/test_wpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,29 @@ def is_port_8000_in_use():
return False


@pytest.fixture(scope="module")
def get_persistent_manifest_path():
directory = ("~/meta" if os.environ.get('TRAVIS') == "true"
else wpt.localpaths.repo_root)
return os.path.join(directory, "MANIFEST.json")


@pytest.fixture(scope="module", autouse=True)
def init_manifest():
with pytest.raises(SystemExit) as excinfo:
wpt.main(argv=["manifest", "--no-download",
"--path", get_persistent_manifest_path()])
assert excinfo.value.code == 0


@pytest.fixture
def manifest_dir():
def update_manifest():
with pytest.raises(SystemExit) as excinfo:
wpt.main(argv=["manifest", "--no-download", "--path", os.path.join(path, "MANIFEST.json")])
assert excinfo.value.code == 0

if os.environ.get('TRAVIS') == "true":
path = "~/meta"
update_manifest()
try:
path = tempfile.mkdtemp()
shutil.copyfile(get_persistent_manifest_path(),
os.path.join(path, "MANIFEST.json"))
yield path
else:
try:
path = tempfile.mkdtemp()
old_path = os.path.join(wpt.localpaths.repo_root, "MANIFEST.json")
if os.path.exists(os.path.join(wpt.localpaths.repo_root, "MANIFEST.json")):
shutil.copyfile(old_path, os.path.join(path, "MANIFEST.json"))
update_manifest()
yield path
finally:
shutil.rmtree(path)
finally:
shutil.rmtree(path)


@pytest.fixture
Expand Down Expand Up @@ -91,7 +93,6 @@ def test_help():
assert excinfo.value.code == 0


@pytest.mark.slow
@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12935")
def test_list_tests(manifest_dir):
Expand Down

0 comments on commit 3bbb06e

Please sign in to comment.