Commit Graph

61 Commits

Author SHA1 Message Date
Dan Smith
83084f72ff Remove future library dependency 2024-05-03 17:56:57 -07:00
Dan Smith
9a69f4dc2d Fix several mypy warnings in chirp.drivers
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.
2024-04-12 18:10:22 -07:00
Dan Smith
9260e3a8e1 Add mypy to style target (for non-driver code)
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.
2024-02-15 15:41:20 -08:00
Daniele Forsi
a4777b6202 Handle plurals in translations 2024-01-16 16:30:07 -08:00
Dan Smith
8bc70be985 Fix style target using sitepackages
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.
2023-12-08 16:23:47 -08:00
Dan Smith
3e672bba22 Add a way to test for compat bytes usage
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.
2023-11-07 16:02:52 -08:00
Jaroslav Škarvada
f9bbde3ac8 tox: use distro's default python
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>
2023-10-20 17:54:00 -07:00
Daniele Forsi
7113480aa4 Ignore false positive "F821 undefined name '_'"
The function _() is installed in Python’s builtins namespace by
chirp/wxui/__init__.py
2023-06-26 17:29:02 -07:00
Dan Smith
32e6548b61 Make flake8 default style linter for new files
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.
2023-03-10 18:07:04 -08:00
Dan Smith
9cdff2b151 Add fast-driver tox target
This makes us only run driver tests for drivers that have had changes.
Note that this only works if you've got an up-to-date origin remote.
2023-01-28 08:51:26 -08:00
Dan Smith
fc8bf81db0 Allow pip caching for tox environments 2023-01-17 15:34:23 -08:00
Dan Smith
12db204002 Make style target run flake8 on chirp.cli 2023-01-14 07:45:56 -08:00
Dan Smith
01c60d181a Remove quotes from flake8 execution
This may be causing issues with tox4 and windows
2023-01-10 15:19:20 -08:00
Dan Smith
6964f1a0cc Drop py2 tox targets 2022-12-28 08:32:01 -08:00
Dan Smith
3284015e09 Collapse report html rows by default
...so that they're actually readable.
2022-12-19 11:32:56 -08:00
Charlie Li
6740f801c7 (Attempt to) fix the tests in light of wxPython 4.2.0
setup.py was intentionally typoed to not specify dependencies, but breaks metadata.
2022-12-14 11:20:30 -08:00
Charlie Li
0f861bf65f Include data files in the chirp package itself
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
2022-12-14 11:20:30 -08:00
Dan Smith
c3a6918177 New tox seems to be complaining about passenv 2022-12-10 19:36:54 -08:00
Dan Smith
1c56250a33 Add model usage stats to test matrix
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.
2022-12-09 09:08:35 -08:00
Charlie Li
c80048f27f tox: whitelist -> allowlist 2022-12-07 13:18:57 -08:00
Dan Smith
6b61a5509b Let tox install us properly
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.
2022-12-07 07:19:29 -08:00
Dan Smith
095a203a76 Merge remote-tracking branch 'origin/master' into py3wxui 2022-11-30 18:25:14 -08:00
Dan Smith
441481b0a7 Mock out time.time during tests
This saves two minutes wall clock time on *just* the clone tests.
2022-11-30 16:37:08 -08:00
Jim Unroe
713b4c305f Changes to tox.ini for better Windows compatibility 2022-11-29 18:18:26 -08:00
Merge Bot
fb581f32c1 Merge commit '115703a8529522248067343a138573051c91c8d3' into py3-sync
# Conflicts:
#	chirp/drivers/icf.py
#	tox.ini
2022-11-22 20:08:16 -08:00
Dan Smith
115703a852 Add a model alias map to the tree
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.
2022-11-22 19:06:38 -08:00
Dan Smith
336d39d32f Fixes for tests under windows 2022-11-21 18:52:00 -08:00
Dan Smith
abdbb93d6f Change pygobject to wxpython for requirements
Accurately reflect what we expect to be installed for the py3
branch.
2022-10-21 16:41:17 -07:00
Dan Smith
b737efff2b Use flake8 on wxui code
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.
2022-10-21 16:11:02 -07:00
Dan Smith
91de7cff54 Run driver tests in parallel 2022-10-09 12:11:50 -07:00
Dan Smith
e43e34b3b8 Add a tool for tracking real-world driver testing
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.
2022-09-21 15:05:09 -07:00
Dan Smith
512d897fa5 Fix make_supported.py to work on py3
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.
2022-09-16 17:47:52 -07:00
Dan Smith
ca6c33153d Parity in py3 tests for recent split on master 2022-09-16 17:20:11 -07:00
Merge Bot
f8985484c5 Merge commit '83a70ea2a2201da09d096ea33e58a7beae48350a' into py3-sync
# Conflicts:
#	tox.ini
2022-09-16 17:08:21 -07:00
Dan Smith
70e168abba Split workflows into tox targets for clarity
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.
2022-09-16 16:52:54 -07:00
Dan Smith
b956227041 Track drivers expected to work on py3
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.
2022-09-09 15:16:07 -07:00
Dan Smith
3792acf9dc Merge branch 'master' into py3
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).
2022-09-09 14:04:46 -07:00
Dan Smith
9d2dd6730f Run tests in github workflow for py3 2022-09-09 08:23:32 -07:00
Dan Smith
fffaa7e765 Make test adapter granular
This makes the unit test adapter granular so you can run individual
tests and drivers for quicker automated testing.
2021-12-06 09:31:15 -08:00
Dan Smith
8e8d8385c7 Giant merge with main branch. Some regressions are still not resolved.
#0
2019-12-05 13:08:48 -08:00
Dan Smith
ba8ecbc90f Add future to tox config
Related to #743
2019-07-11 19:32:29 -07:00
Dan Smith
b7e2408077 Include pytest-xdist in the test environments
Now that everything runs under pytest, I can run the entire suite on both pythons
in just over two minutes with "tox -- -n auto --dist=loadscope"

#0
2019-02-14 06:39:04 -08:00
Dan Smith
a7d322068e [py3] Finally, unified test running across all environments and pythons
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
2019-02-13 16:53:28 -08:00
Dan Smith
cec1fdc2e6 [py3] Put a py3clean environment in the list before the py3 jobs
This helps prevent python3 from stumbling over py2 cache files

#495
2019-02-11 16:21:28 -08:00
Dan Smith
7a296bd85b Make tox not generate sdist
For speed.

#0
2019-02-11 14:04:07 -08:00
Dan Smith
593b3ce56b [py3] Include future in the py2 test environment
#495
2019-02-10 14:41:34 -08:00
Dan Smith
d226e5f665 [py3] Split py3 tox environment into py3unit and py3driver
#495
2019-02-09 12:36:04 -08:00
Dan Smith
9b3664929a [py3]: Fix run_tests.py:
- 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
2019-02-08 13:15:09 -08:00
Dan Smith
de6d146d8a [py3] Changes to make test_shiftdialog compatible
This marks the point at which all the tests/unit tests pass in py3

#495
2019-02-07 11:01:48 -08:00
Dan Smith
d7ec29497b [py3] Changes to make test_directory compatible
#495
2019-02-07 10:43:52 -08:00