mdmintz / pynose Goto Github PK
View Code? Open in Web Editor NEWpynose fixes nose to extend unittest and make testing easier
Home Page: https://pypi.org/project/pynose/
License: MIT License
pynose fixes nose to extend unittest and make testing easier
Home Page: https://pypi.org/project/pynose/
License: MIT License
https://pypistats.org/packages/pynose shows that numbers are low for Python 3.6 downloads:
Python 3.6 users never really needed pynose
anyway because original nose
works fine on it.
Add --capture-logs
to capture output from all logging levels (which hides all logging output).
(Also settable with os.environ
--> "NOSE_CAPTURELOGS"
"1"
)
--
Note: To capture the output of print()
statements, use the existing --capture-output
option.
(Also settable with os.environ
--> "NOSE_CAPTURE"
"1"
)
Add --logging-init
to automatically call logging.basicConfig(level)
, which may be needed if you want to change the default logging level using --logging-level=LEVEL
.
(Also settable with os.environ
--> "NOSE_LOGINIT"
"1"
)
I was looking into introducing pynose
to Fedora. It seems a viable drop-in replacement for the no longer maintained nose.
In a preliminary discussion the issue of pynose
not providing any tests came up. Ye olde 👃 did have unit tests. Are you planning on providing unit tests in the future? While not mandatory for the software to be packaged for Fedora, where available we do run them in order to detect potential issues early.
Somewhat related: The documentation link on PyPI sends you to the documentation of legacy nose
. While most of it probably still applies, it's also a bit confusing. Not the least because there it still mentions Current version: 1.3.7, which links back to nose
.
To enable capture, set a Python env variable called "NOSE_CAPTURE" to "1".
It can be done like this in an __init__.py
file:
import os
os.environ["NOSE_CAPTURE"] = "1"
This restores the default setting of nose
, which is capturing output.
(Note that if output is captured, print()
calls won't be seen.)
(Capturing output should also be enabled with: --capture-output
.)
I've run extensive tests using Python 3.13.0a4
, and everything is working correctly.
Python 3.13.0a4
can be officially supported now.
Hi Michael
Thanks for setting up this fork.
I am trying to use this project, in an effort to stop using my personal fork of nose.
I can't get this to work with Python 3.11
I see that the GitHub Action job run with 3.11 is green - https://github.com/mdmintz/pynose/actions/runs/4867487327/jobs/8680119707
I guess that the automated tests don't do any package discovery
The error is
AttributeError: module 'inspect' has no attribute 'getargspec'`
$ ./build-py3/bin/pynose src/chevah_compat/tests/
E
======================================================================
ERROR: test suite for <module 'chevah_compat.tests' from '/home/adi/chevah/compat/src/chevah_compat/tests/__init__.py'>
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/adi/chevah/compat/build-py3/lib/python3.11/site-packages/nose/suite.py", line 172, in run
self.setUp()
File "/home/adi/chevah/compat/build-py3/lib/python3.11/site-packages/nose/suite.py", line 247, in setUp
self.setupContext(ancestor)
File "/home/adi/chevah/compat/build-py3/lib/python3.11/site-packages/nose/suite.py", line 268, in setupContext
try_run(context, names)
File "/home/adi/chevah/compat/build-py3/lib/python3.11/site-packages/nose/util.py", line 416, in try_run
args, varargs, varkw, defaults = inspect.getargspec(func)
^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'
----------------------------------------------------------------------
Ran 0 tests in 0.001s
FAILED (errors=1)
I have something like this.
$ ./build-py3/bin/nosetests --version
nosetests version 1.4.4
$ ./build-py3/bin/pynose --version
pynose version 1.4.4
$ ./build-py3/bin/python --version
Python 3.11.3
$ cat build-py3/bin/pynose
#!/home/adi/chevah/compat/build-py3/bin/python
from nose import main
if __name__ == '__main__':
main()
$ cat /home/adi/chevah/compat/build-py3/lib/python3.11/site-packages/nose/__init__.py
import sys
from nose.core import collector, main, run, run_exit, runmodule
from nose.exc import SkipTest, DeprecatedTest
from nose.tools import with_setup
from nose.__version__ import __version__
import collections
__author__ = 'Jason Pellerin (Original) / Michael Mintz (Update)'
version_list = [int(i) for i in __version__.split(".") if i.isdigit()]
__versioninfo__ = tuple(version_list)
__version__ = '.'.join(map(str, __versioninfo__))
__all__ = [
'main', 'run', 'run_exit', 'runmodule', 'with_setup',
'SkipTest', 'DeprecatedTest', 'collector'
]
if sys.version_info >= (3, 10):
collections.Callable = collections.abc.Callable
It seems like your package is claiming the wrong license: The original nose implementation is subject to LGPL-2.1-only as far as I can see (https://github.com/nose-devs/nose/blob/master/lgpl.txt), but you are distributing your version as MIT.
Apparently, you reuse most of the original code in your fork and thus are forced to make your version available as LGPL-2.1-only as well (see §2 of the LPGL-2.1 license text, especially §2c). (In theory, §3 allows you to choose GPL-2.0 or any later GPL version as well, but this would mean an even stronger copyleft variant.)
This project uses the imp
module which has been deprecated since Python 3.4 and removed in 3.12:
PendingDeprecationWarning
since 3.4 (2014)DeprecationWarning
since 3.5 (2015)DeprecationWarning
to say removal in 3.12 since 3.10 (2021)Python 3.12 is set for release on 2023-10-02 and this library is one of the top 5,000 most-downloaded from PyPI.
Please could you upgrade to use importlib
? The imp
docs have suggestions on what to use to replace each function and constant.
Getting this message: DeprecationWarning: pkg_resources is deprecated as an API.
Any usage of pkg_resources
should be replaced.
importlib.metadata
is a strong candidate as a replacement for methods.
For script creation in setup.py
, scripts
should be replaced with entry_points
: console_scripts
.
I have a CI test suite that is run with nose for older Python versions, going back to 2.6, and your revamp (many thanks) for 3.9 and later. The output is not so easy to check for the latter case, presumably because of the different default for -s
.
With -s
as the default, the documented options would have to be changed to unset that option, leaving presumably NOSE_NOCAPTURE=0
as the only solution.
In case you should want to make further changes to the option defaults, could there be a single environment variable that forces all option defaults to match those in the original nose?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.