Skip to content

Commit

Permalink
use the conda forge implementation on the vnu-validator (#17)
Browse files Browse the repository at this point in the history
* swap out old invocation with conda based invocation
* rm vnu-jar from node install
  • Loading branch information
tonyfast authored Dec 10, 2023
1 parent 3aeda4b commit b153cc1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
3 changes: 2 additions & 1 deletion .github/test-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ dependencies:
- scipy
- doit
- mkdocs-material
- mkdocstrings[python]
- mkdocstrings[python]
- vnu-validator
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
playwright install --with-deps chromium
- name: init node & files
run: |
npm install vnu-jar axe-core
npm install axe-core
doit copy
- name: init dev module
run: |
Expand Down
29 changes: 10 additions & 19 deletions tests/test_w3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,31 @@
import pathlib
import re
import shlex
import shutil
import subprocess
from pathlib import Path

from json import dumps
from logging import getLogger
from pathlib import Path

import exceptiongroup
from pytest import mark, param


from tests.test_smoke import CONFIGURATIONS, get_target_html

EXCLUDE = re.compile(
"""or with a “role” attribute whose value is “table”, “grid”, or “treegrid”.$"""
# https://github.com/validator/validator/issues/1125
)


@functools.lru_cache(1)
def vnu_jar():
VNU_JAR = (
pathlib.Path(subprocess.check_output(shlex.split("npm root vnu-jar")).strip().decode())
/ "vnu-jar/build/dist/vnu.jar"
)
assert VNU_JAR.exists()
return VNU_JAR
VNU = shutil.which("vnu") or shutil.which("vnu.cmd")


def validate_html(*files: pathlib.Path) -> dict:
return json.loads(
subprocess.check_output(
shlex.split(f"java -jar {vnu_jar()} --stdout --format json --exit-zero-always")
+ list(files)
[VNU, "--stdout", "--format", "json", "--exit-zero-always", *files]
).decode()
)

Expand Down Expand Up @@ -64,13 +62,6 @@ def raise_if_errors(results, exclude=EXCLUDE):
raise exceptiongroup.ExceptionGroup("nu validator errors", exceptions)


from json import dumps
from logging import getLogger
from pathlib import Path

import exceptiongroup
from pytest import mark, param

HERE = Path(__file__).parent
NOTEBOOKS = HERE / "notebooks"
EXPORTS = HERE / "exports"
Expand Down

0 comments on commit b153cc1

Please sign in to comment.