cps-org / cps-config

A drop in replacement for pkg-config/pkgconf using cps files
MIT License
15 stars 7 forks source link

missing python test dependencies #37

Closed tylerjw closed 2 months ago

tylerjw commented 2 months ago

When I run the tests I get this failure:

~/code/cps-config: ninja -C builddir test                                                                         03/08/24 14:19:24 PM
ninja: Entering directory `builddir'
[0/1] Running all tests.
1/3 version                         OK              0.01s
2/3 utils                           OK              0.00s
3/3 pkg-config compatibility        ERROR           0.06s   exit status 1
>>> LD_LIBRARY_PATH=/home/tyler/code/cps-config/builddir/subprojects/fmt-10.1.1:/home/tyler/code/cps-config/builddir/subprojects/jsoncpp-1.9.5 MALLOC_PERTURB_=122 CPS_PATH=/home/tyler/code/cps-config/tests/cases ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 /home/tyler/code/cps-config/tests/runner.py ./cps-config tests/cases.toml
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
stderr:
Traceback (most recent call last):
  File "/home/tyler/code/cps-config/tests/runner.py", line 13, in <module>
    import tomllib
ModuleNotFoundError: No module named 'tomllib'

(test program exited with status code 1)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Summary of Failures:

3/3 pkg-config compatibility ERROR           0.06s   exit status 1

Ok:                 2   
Expected Fail:      0   
Fail:               1   
Unexpected Pass:    0   
Skipped:            0   
Timeout:            0   

Full log written to /home/tyler/code/cps-config/builddir/meson-logs/testlog.txt
FAILED: meson-internal__test 
/nix/store/gpppf590dmw77nsr0zv86b8kkkfigiwl-meson-1.3.2/bin/meson test --no-rebuild --print-errorlogs
ninja: build stopped: subcommand failed.

I suspect there are python dependencies for testing. It would be helpful if these were documented via some file I could use to create a python enviroment for this project. I've had good success with pixi for this in the past.

tylerjw commented 2 months ago

Through some googling I found that tomllib is part of the Python standard library but only after 3.11 (I'm on Ubuntu 22.04 with 3.10 installed). It was easy enough for me to create an environment with 3.11 installed. It would be helpful to document this.

dcbaker commented 2 months ago

I wondered if that would be an issue. There's another option here, tomllib in the python standard library was previously called tomli, and was developed as a third party module. We could also support older python with tomli installed. I can send a patch for that.

tylerjw commented 2 months ago

I think it would be ok to just call it out in the readme that you developed it with a specific version of python.

tylerjw commented 2 months ago

Locally this is what I did to setup an environment for working on this project. I created a pixi.toml:

[project]
name = "cps-config"
version = "0.1.0"
channels = ["conda-forge"]
platforms = ["linux-64"]

[tasks]
setup = "meson setup build"
build = { cmd = "ninja", cwd = "build", depends_on = ["setup"] }
test = { cmd = "ninja test", cwd = "build", depends_on = ["build"] }

[dependencies]
python = "3.12.*"
ninja = ">=1.11.1,<1.12"
meson = ">=1.3.2,<1.4"
cxx-compiler = ">=1.7.0,<1.8"

Then after installing the pixi tool I was able to do these things:

Install environment dependencies:

pixi install

Config/Build/Test

pixi run test
dcbaker commented 2 months ago

Ah, Conda :)

I opened a PR, i didnt realize I was also using some asyncio stuff from 3.11, so for now I'll just document it and have Meson enforce that for us. We can wind back the requirement later if there's a need/want for it.