From: Daira Hopwood Date: Fri, 20 Mar 2015 17:18:56 +0000 (+0000) Subject: Enable Python deprecation warnings when running tests. X-Git-Url: https://git.rkrishnan.org/?a=commitdiff_plain;h=758599784eccd36b108d8969ba527733a0340a2c;p=tahoe-lafs%2Ftahoe-lafs.git Enable Python deprecation warnings when running tests. Signed-off-by: Daira Hopwood --- diff --git a/Makefile b/Makefile index 8a8b5ee3..b2914060 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ check: test .PHONY: quicktest quicktest: make-version - $(TAHOE) debug trial $(TRIALARGS) $(TEST) + @PYTHONWARNINGS=default::DeprecationWarning $(TAHOE) debug trial $(TRIALARGS) $(TEST) # "make tmpfstest" may be a faster way of running tests on Linux. It works best when you have # at least 330 MiB of free physical memory (to run the whole test suite). Since it uses sudo @@ -90,7 +90,7 @@ tmpfstest: .PHONY: _tmpfstest _tmpfstest: make-version sudo mount -t tmpfs -o size=400m tmpfs '$(TMPDIR)' - -$(TAHOE) debug trial --rterrors '--temp-directory=$(TMPDIR)/_trial_temp' $(TRIALARGS) $(TEST) + @PYTHONWARNINGS=default::DeprecationWarning -$(TAHOE) debug trial --rterrors '--temp-directory=$(TMPDIR)/_trial_temp' $(TRIALARGS) $(TEST) sudo umount '$(TMPDIR)' rmdir '$(TMPDIR)' @@ -111,7 +111,7 @@ COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmyd .PHONY: test-coverage test-coverage: build rm -f .coverage - $(TAHOE) '@$(COVERAGE)' run $(COVERAGEARGS) @tahoe debug trial $(TRIALARGS) $(TEST) + @PYTHONWARNINGS=default::DeprecationWarning $(TAHOE) '@$(COVERAGE)' run $(COVERAGEARGS) @tahoe debug trial $(TRIALARGS) $(TEST) .PHONY: coverage-output coverage-output: diff --git a/setup.py b/setup.py index d6fe60b9..846b84aa 100644 --- a/setup.py +++ b/setup.py @@ -159,6 +159,10 @@ class Trial(Command): pass def run(self): + # enable deprecation warnings (once per line) even on Python 2.7 + new_env = os.environ.copy() + new_env["PYTHONWARNINGS"] = "default::DeprecationWarning" + args = [sys.executable, os.path.join('bin', 'tahoe')] if self.coverage: @@ -195,7 +199,7 @@ class Trial(Command): args.append('--reporter=' + self.reporter) if self.suite: args.append(self.suite) - rc = subprocess.call(args) + rc = subprocess.call(args, env=new_env) sys.exit(rc)