nose-devs / nose2

The successor to nose, based on unittest2
https://nose2.io
Other
784 stars 134 forks source link

v0.15.0 seemed to break my ini config #614

Closed grhwalls closed 1 month ago

grhwalls commented 1 month ago

Here is my ini config file:

[flake8]
max-line-length = 120
extend-ignore = E722

[unittest]
plugins = nose2.plugins.layers
          nose2.plugins.junitxml

[junit-xml]
always-on = False
keep_restricted = False
path = nosetests.xml
test_fullname = False

[layer-reporter]
always-on = True
colors = False

Running nose2 -c tox.ini --junit-xml <testNames> I get: nose2: error: Unrecognized arguments: --junit-xml

Reverting back to v0.14.2 fixes my issue.

sirosen commented 1 month ago

Do you have a pyproject.toml for your repo? 0.15.0 introduces the possibility of config in [tool.nose2] there, so there are two easy possibilities:

I wouldn't be shocked if the TOML loading code is imperfect. It's the first time that codepath has been touched in a really long time. But I need a little more info to reproduce this.

grhwalls commented 1 month ago

pyproject.toml:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "axi_hw_devices"
description="Library for device specific operations"
readme = "README.rst"
requires-python = ">=3"

# these are direct, imported dependencies. There may be other packages which are assumed, but
# since alternate packages are possible to use (as long as they have similar interfaces), they are
# not called out explicitly here.
dependencies = [
]

dynamic = ["version"]

[project.optional-dependencies]
dev = [
  "build",
  "nose2",
  "flake8",
  "twine",
]
test = [
  "axi_hw_devices[dev]",
  "vivado_jtag >= 3.0.0.dev",
  "xil_axi_ip >= 2.1.0.dev",
]

[tool.setuptools]
packages = ["axi_hw_devices",]

[tool.setuptools.dynamic]
version = {attr = "axi_hw_devices.version.__version__"}
sirosen commented 1 month ago

I just looked into this and figured it out. It seems obvious in hindsight, but there's a bug introduced in the new pyproject.toml loading code in which it won't read config files (even those passed with -c) if they don't end in .cfg.

It's simply an incorrect conditional being used to dispatch between INI loading and pyproject.toml loading.

I'm cooking up a regression test, and then I'll make the fix. Expect a v0.15.1 to ship within the next few hours ( :crossed_fingers: ).

sirosen commented 1 month ago

v0.15.1 is now available! :tada:

Please let me know if it clears things up (as it should) or if you see other issues.

grhwalls commented 1 month ago

v0.15.1 fixed my issue! Thanks!