This is really kinda meh in terms of usefulness but getting these
squared away (or ignored) allows us to run the rest of mypy on the
drivers for the other benefits we might be able to actually see.
My patience with mypy is very thin, but it does catch some stuff that
other checkers don't, even outside the realm of typing. This should
at least make sure any type annotations we _do_ get are correct.
There are a lot of errors in the drivers, so limit this to just the
core code for now.
We don't need to use sitepackages for that, which also prevents
installing flake8 in there if it's already site installed. We also
don't need future in there.
A lot of radios are still relying on get_raw() returning a str instead
of a bytes. This adds an environment flag that can be used to run
without that compatibility layer to smoke out those offending drivers.
I think it should used the distro's default python version and not
override it, because otherwise e.g. on Fedora Rawhide (f40) it fails:
> py312: failed with env name py312 conflicting with base python python3
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This makes cpep8 run flake8 on anything *not* in the manifest or
*not* in the blacklist. Thus, all new files will get flake8 run against
them by default. It adds a bunch of files to the blacklist that were
not in manifest and thus still aren't compliant. Those need to get
cleaned up, obviously.
No new files should be added to cpep8.manifest going forward so that
the stricter flake8 rules get applied by default. Ideally we'd also
remove files from cpep8.manifest as well so we can move to just one
set of rules for everything, but that will take a while.
Data files outside the package are not installed in binary distributions, so move them inside. Use importlib_resources to load icon and stock configs.
- use only the newer files(), as_files() and namespace APIs introduced in Python 3.10
- use the importlib_resources package if Python < 3.10
- remove obviated pkg_path()
- bump minimum Python version to 3.7
Fix test paths to account for the move
This adds some stats about which models are the most widely used to
the test matrix to help guide decisions about total testing versus
relevant testing.
Model stats are captured from our own databases, and are far from
perfect, but are probably sufficiently useful. Stats captured on
9-Dec-2022.
This avoids the need for develop in the makesupported target. Also,
use "python" in the test commands, which tox links to the basepython.
Otherwise it's possible to run python from outside the virtualenv,
like on windows with "python3". This is why we needed to add
python3.exe and why we don't need it anymore.
This is sort of a decoder ring for the massive number of straight
rebrands that exist out there. We can use this to generate the
SupportedRadios list on the web site and potentially add something to
chirp itself to help users find the right model.
Some of the aliases from the web site also pointed at non-existent
models. Those lines are in the data file, but commented out until
we know what to do with them.
Note that the test added here uncovered a number of situations where
we have subclassed radios with aliases, making the subclasses inherit
the aliases, unintentionally. This also fixes those, and will prevent
that from happening in the future.
Our custom cpep8 thing for drivers is mostly legacy and used because
we don't have compliance across all the drivers. For wxui, we should
enforce flake8 compliance from the start. This makes our style
target do that and fixes up all the current complaints.
Converting a driver to pass tests on python3 is not quite the same
as it actually working in the real world. We need to keep track of
which drivers have been tested in the wild, separate from those that
merely pass tests.
This adds a file tests/py3_driver-testers.txt, which is a simple list
of the driver ID key and the person/date when it was tested. Running
the "makesupported" tox target will also generate
tests/Python3_Driver_Testing.md, which will be render-able in github
for easy viewing.
If you test a driver on python3, please add a line to the tracking
file, run the makesupported target, and update the markdown file.
This will let us generate the usual list of supported drivers and
features on python3 to keep track of the difference. Note this
had to fix a dict keys bug in th_uvf8d.py in order to work.
This also moves test.yaml to py2-test.yaml for parity with the
py3 branch, and adds a target for generating the model support
matrix, which we should also be doing.
Right now we have a bunch of drivers that don't even import in
py3 so we don't know if they work or not. We handle that by ignoring
import errors in the test adapter. That could mask a regression
when merging from py2-based master.
This adds a list of drivers that we expect to fail to import (keyed
by the image file, which is how we test them and the only thing we
can know about them if they failed to import). If we fail to import
a driver that is not in that list, we will fail the discovery. If
we run one successfully on that list, we mark it as XPASS so that
pytest will warn us to remove it from the list.
I wrote this on top of the above merge commit (after realizing it
was needed). But, I tested this on the pre-merge branch with this
exclusion file, and there were no XPASS tests, which means nothing
specified as broken here was working before the merge.
This looks like a lot of change, but it was pretty trivial. Many
of the conflicts came from d40963b3ed
which fixed a bunch of typos. There were some test adapter changes,
some GTK UI fixes, RR canada additions, and the usual driver
maintenance.
I didn't test the GTK UI since it seems like we're abandoning keeping
that working in python2 or python3 with pygobject (which is fine).
pytest doesn't support the loadTests() discovery protocol, which means it would
not ever find the driver test adapter in tests/__init__.py. So, this adds another
adapter just for pytest (et al) which will trigger the test loader and make it
find them.
Now, with all environments and python versions, you get nicer pytest output,
and can use expressions to run subsets of tests, like:
tox -epy3driver 880.*clone
#495
- Import hack to work from a variety of places. This is really ugly,
but these are going away once the driver files can at least be imported.
- Something in the 2to3ing earlier broke the settings tests. Had to add
len and getitem to RadioSettingValueString, which caused an infinite
loop in the test's compare_settings. I dunno what I was thinking with
the latter, but it seems like a infinite loop waiting to happen and
it's hard to see through the blur how that ever worked.
#495