-
Notifications
You must be signed in to change notification settings - Fork 0
Python First Commit
info-rchitect edited this page Jan 6, 2020
·
4 revisions
- Create your Python source code at
o2/python/origen
. Your Python file must import theorigen
module as so:
import origen
- If you need to use new Python dependencies, you must add them to the
o2/pyproject.toml
file under[tool.poetry.dependencies]
. After you add the new dependencies you must runpoetry update
from theo2/example
directory. For more info, see this guide.
[tool.poetry.dependencies]
python = "^3.6"
termcolor = ">= 1.1.0"
pyreadline = { "version" = "^2.1", "platform" = "win32" }
colorama = "^0.4"
bs4 = "0.0.1"
beautifulsoup4 = "4.8.2"
lxml = "4.4.2"
# Your new dependencies go here
- Create a unit test Python file at
o2/example/tests
. The file name must end with_test.py
. It also must import the origen module, the unit test methods must start withtest
, and one of example DUTs must be isntantiated as so:
import origen
def test_translator_ip_xact():
origen.app.instantiate_dut("dut.falcon")
# Your unit tests go here
# https://docs.pytest.org/en/latest/
- Once you have written unit tests you must run
pytest
from theo2/example
directory as so:
info-rchitect@D10-brian:/mnt/c/o2/example$ poetry run pytest tests/translator_test.py
========================================== test session starts ==========================================
platform linux -- Python 3.8.1, pytest-3.10.1, py-1.8.1, pluggy-0.13.1
rootdir: /mnt/c/o2/example, inifile: setup.cfg
collected 1 item
tests/translator_test.py . [100%]
======================================= 1 passed in 0.21 seconds ========================================
- Once the unit tests are passing, create your branch and make a PR via Git