docs: remove common import (#33310)
* add opcar
* fix references
* actually better to split this so opendbc will test docs conventions, and openpilot will test diffing
* not exe
* clean up
old-commit-hash: 424b657376
pull/33314/head
parent
9e5fe1e5c0
commit
9b0adebec8
10 changed files with 52 additions and 46 deletions
@ -0,0 +1 @@ |
|||||||
|
# This folder will be renamed back to car after the opendbc car split |
@ -0,0 +1,21 @@ |
|||||||
|
#!/usr/bin/env python3 |
||||||
|
import argparse |
||||||
|
import os |
||||||
|
|
||||||
|
from openpilot.common.basedir import BASEDIR |
||||||
|
from openpilot.selfdrive.car.docs import get_all_car_docs, generate_cars_md |
||||||
|
|
||||||
|
CARS_MD_OUT = os.path.join(BASEDIR, "docs", "CARS.md") |
||||||
|
CARS_MD_TEMPLATE = os.path.join(BASEDIR, "selfdrive", "car", "CARS_template.md") |
||||||
|
|
||||||
|
if __name__ == "__main__": |
||||||
|
parser = argparse.ArgumentParser(description="Auto generates supported cars documentation", |
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
||||||
|
|
||||||
|
parser.add_argument("--template", default=CARS_MD_TEMPLATE, help="Override default template filename") |
||||||
|
parser.add_argument("--out", default=CARS_MD_OUT, help="Override default generated filename") |
||||||
|
args = parser.parse_args() |
||||||
|
|
||||||
|
with open(args.out, 'w') as f: |
||||||
|
f.write(generate_cars_md(get_all_car_docs(), args.template)) |
||||||
|
print(f"Generated and written to {args.out}") |
@ -0,0 +1,26 @@ |
|||||||
|
import os |
||||||
|
|
||||||
|
from openpilot.common.basedir import BASEDIR |
||||||
|
from openpilot.selfdrive.car.docs import generate_cars_md, get_all_car_docs |
||||||
|
from openpilot.selfdrive.debug.dump_car_docs import dump_car_docs |
||||||
|
from openpilot.selfdrive.debug.print_docs_diff import print_car_docs_diff |
||||||
|
from openpilot.selfdrive.opcar.docs import CARS_MD_OUT, CARS_MD_TEMPLATE |
||||||
|
|
||||||
|
|
||||||
|
class TestCarDocs: |
||||||
|
@classmethod |
||||||
|
def setup_class(cls): |
||||||
|
cls.all_cars = get_all_car_docs() |
||||||
|
|
||||||
|
def test_generator(self): |
||||||
|
generated_cars_md = generate_cars_md(self.all_cars, CARS_MD_TEMPLATE) |
||||||
|
with open(CARS_MD_OUT) as f: |
||||||
|
current_cars_md = f.read() |
||||||
|
|
||||||
|
assert generated_cars_md == current_cars_md, "Run selfdrive/opcar/docs.py to update the compatibility documentation" |
||||||
|
|
||||||
|
def test_docs_diff(self): |
||||||
|
dump_path = os.path.join(BASEDIR, "selfdrive", "car", "tests", "cars_dump") |
||||||
|
dump_car_docs(dump_path) |
||||||
|
print_car_docs_diff(dump_path) |
||||||
|
os.remove(dump_path) |
Loading…
Reference in new issue