adafruit / Adafruit_CircuitPython_PIOASM

Simple assembler to convert pioasm to bytes
MIT License
27 stars 17 forks source link

support .offset pseudo-op #59

Closed jepler closed 1 year ago

jepler commented 1 year ago

Accompanies https://github.com/adafruit/circuitpython/pull/8223 so that a program can include its required offset in the source as a ".offset" directive.

jepler commented 1 year ago

@tekktrik the tests are failing in a surprising way. I know you were looking at how tests were run in our workflows, maybe you can make sense of this?

Now, all the tests fail like so:

______________________ ERROR collecting tests/test_mov.py ______________________
ImportError while importing test module '/home/runner/work/Adafruit_CircuitPython_PIOASM/Adafruit_CircuitPython_PIOASM/tests/test_mov.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_mov.py:9: in <module>
    from pytest_helpers import assert_assembles_to, assert_assembly_fails
tests/pytest_helpers.py:11: in <module>
    import adafruit_pioasm
E   ModuleNotFoundError: No module named 'adafruit_pioasm'

It's as though something that would put adafruit_pioasm on the sys.path is not happening. but I don't see any changes anywhere that would affect that.

I do notice the failed run used 3.11 and last successful run 3.9; however, I tried experimentally requesting python 3.9 in the workflow and that didn't make it succeed.

The pytest version was the same in both runs (7.4.0).

I do get the same failure locally if I just run pytest in ~/src/bundle/helpers/pioasm, and it's fixed if I use PYTHONPATH=. pytest. Locally I'm using 3.11.2.

tekktrik commented 1 year ago

I think the code running right now is pytest. This doesn't add the current directory to the path whereas python -m pytest does, which looks to likely be the problem here. Not sure why it would have changed from passing to failing but I do know that the difference between the aforementioned is that path difference.

jepler commented 1 year ago

I also notice that pytest fails and python -mpytest succeeds: https://docs.pytest.org/en/7.4.x/explanation/pythonpath.html#invoking-pytest-versus-python-m-pytest

tekktrik commented 1 year ago

I only recently encountered this information! But it does appear to be the issue. A fix to the unified CI should resolve it. I can submit a PR to update it now.

jepler commented 1 year ago

The failure should be fixed by