diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-11-11 21:35:41 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-11-11 21:35:41 +0100 |
commit | 0662915f58949a4084f9fb0c278d143708cf3ede (patch) | |
tree | 48ad658a3312343a1a42bf268a015aaace562c86 /psutil/_psutil_common.c | |
parent | ffde3264f09c5412ce3987617130f2c9d5d7a22b (diff) | |
download | psutil-0662915f58949a4084f9fb0c278d143708cf3ede.tar.gz |
get rid of PSUTIL_TESTING env var: it must be necessarily set from cmdline, hence 'python -m psutil.tests' won't work out of the boxpsutil-test-flag
Diffstat (limited to 'psutil/_psutil_common.c')
-rw-r--r-- | psutil/_psutil_common.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/psutil/_psutil_common.c b/psutil/_psutil_common.c index dace4724..1fd2344e 100644 --- a/psutil/_psutil_common.c +++ b/psutil/_psutil_common.c @@ -37,7 +37,7 @@ AccessDenied(void) { } -static int _psutil_testing = -1; +static int _psutil_testing = 0; /* @@ -45,12 +45,6 @@ static int _psutil_testing = -1; */ int psutil_testing(void) { - if (_psutil_testing == -1) { - if (getenv("PSUTIL_TESTING") != NULL) - _psutil_testing = 1; - else - _psutil_testing = 0; - } return _psutil_testing; } @@ -59,7 +53,7 @@ psutil_testing(void) { * Return True if PSUTIL_TESTING env var is set else False. */ PyObject * -py_psutil_testing(PyObject *self, PyObject *args) { +py_psutil_is_testing(PyObject *self, PyObject *args) { PyObject *res; res = psutil_testing() ? Py_True : Py_False; Py_INCREF(res); @@ -67,6 +61,14 @@ py_psutil_testing(PyObject *self, PyObject *args) { } +PyObject * +py_psutil_set_testing(PyObject *self, PyObject *args) { + _psutil_testing = 1; + Py_INCREF(Py_None); + return Py_None; +} + + /* * Backport of unicode FS APIs from Python 3. * On Python 2 we just return a plain byte string |