redstarcomrade has quit [Remote host closed the connection]
redstarcomrade has joined #glasgow
redstarcomrade has quit [Read error: Connection reset by peer]
<Wanda[cis]>
Catherine: so, with regards to Python 3.12 support, there is one thing left other than waiting for aiohttp to fix their build [https://github.com/aio-libs/aiohttp/pull/7315]
<Wanda[cis]>
namely, setuptools is no longer installed by default, which breaks test.py, because it imports ScanningLoader from setuptools internals
<Wanda[cis]>
which... is apparently not documented anywhere in setuptools documentation in the first place?
<Wanda[cis]>
anyway, AFAICT, the reason it is needed is because glasgow includes test code in the same .py files as application code, and raw unittest (and a few other test runners we tried) only looks for tests in Python files named test_*.py
<Wanda[cis]>
what do you think about just moving to the usual convention of splitting test code into separate files?
<whitequark[cis]>
I really like the concept of having the entire applet in a single file and am not ready to ditch it
<Wanda[cis]>
true, it is quite handy (for most applets at least)
<SnoopJ>
pytest makes the discovery rules configurable for whatever it's worth (I don't know if that would be an undue burden on the glasgow ecosystem vs. plain ol' unittest)
<whitequark[cis]>
depending on pytest is probably ok? does it depend on a lot of stuff itself?
<SnoopJ>
oh, unittest does too
<Wanda[cis]>
(though we've been wondering a little if that contributes to startup time much)
<SnoopJ>
(at least for the file pattern)
<whitequark[cis]>
Wanda[cis]: afaik no
<whitequark[cis]>
pkg_resources sure did
<Wanda[cis]>
yeah, but trying '*.py' as the pattern just produces some weird error
<Wanda[cis]>
because it tries to import init twice
<whitequark[cis]>
whitequark[cis]: I wanted to get rid of that for so long
<whitequark[cis]>
Wanda[cis]: you need to specify the root too I think?
<Wanda[cis]>
s/init/`__init__.py`/
<SnoopJ>
whitequark[cis], I would not characterize it as "a lot", but it's 6 packages (+ pytest itself)
<Wanda[cis]>
oh, pattern '[a-z]*.py' works
<Wanda[cis]>
I think the pattern needs to not match __init__.py because if it does, it'll be imported once as package, and second time as package.__init__
<Wanda[cis]>
python -m unittest discover -s glasgow -p '[a-z]*.py' -t . -v does the trick
<Wanda[cis]>
Catherine: should I replace `test.py` contents with an equivalent `unittest.main` invocation?
<whitequark[cis]>
ye sure
redstarcomrade has joined #glasgow
redstarcomrade has quit [Read error: Connection reset by peer]
redstarcomrade has joined #glasgow
redstarcomrade has quit [Changing host]
redstarcomrade has joined #glasgow
joerg has quit [Ping timeout: 250 seconds]
joerg has joined #glasgow
redstarcomrade has quit [Read error: Connection reset by peer]
ar-jan has joined #glasgow
<d1b2>
<attiegrande> if that's regex, might you prefer [^_].*\.py - to not match files starting with _, but keep all others
<d1b2>
<attiegrande> thinking of files with numbers / dashes / etc...
<Wanda[cis]>
it's glob, not regex
<Wanda[cis]>
and valid Python module names cannot start with anything other than _a-zA-Z
<SnoopJ>
does "valid Python module" mean something more narrow than what the reference implementation supports? You can definitely use other names in general: https://snoopj.dev/pyplay/猫.py
<SnoopJ>
(not that this edge is particularly large when you're working in a domain where you expect those chars)
<galibert[m]1>
Please keep Glasgow's module names in the BMP, tia
<SnoopJ>
heh
<Wanda[cis]>
hrm, actually I'm going to change it to *[^_].py
<Wanda[cis]>
we can have a leading underscore after all
<galibert[m]1>
it's trailing you shouldn't have?
<Wanda[cis]>
ideally we'd have "match any name other than __init__.py specifically"
<Wanda[cis]>
but that's not doable with a single glob
<galibert[m]1>
that would indeed be nice
<galibert[m]1>
positive-only matching sucks
<d1b2>
<attiegrande> re glob vs regex ... ah, that makes more sense
GNUmoon2 has quit [Remote host closed the connection]