[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir

2014-10-01 Thread Francis MB

Francis MB added the comment:

I have to thank for your time, David!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir

2014-09-30 Thread R. David Murray

R. David Murray added the comment:

Thanks, Francis.

--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir

2014-09-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c5bcc4d07344 by R David Murray in branch '2.7':
#22512: move distutils rpm test's .rpmdb to testing tmpdir.
https://hg.python.org/cpython/rev/c5bcc4d07344

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir

2014-09-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ec6cee80926f by R David Murray in branch '3.4':
#22512: move distutils rpm test's .rpmdb to testing tmpdir.
https://hg.python.org/cpython/rev/ec6cee80926f

New changeset 4877f91a0389 by R David Murray in branch 'default':
Merge: #22512: move distutils rpm test's .rpmdb to testing tmpdir.
https://hg.python.org/cpython/rev/4877f91a0389

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir

2014-09-29 Thread R. David Murray

R. David Murray added the comment:

Yes, sorry I forgot to change the stage.

--
stage:  -> commit review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir

2014-09-29 Thread Francis MB

Francis MB added the comment:

No problem, but is the, 3 lines, patch ok?
what are the next steps, if yes?
Shouldn't be the issue status now 'patch review' or similar?

Thanks in advance!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir

2014-09-29 Thread R. David Murray

R. David Murray added the comment:

Sorry, I'm not that familiar with distutils and did not realize it had stuff 
for environment protection in the setUp/tearDown.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir

2014-09-29 Thread Francis MB

Francis MB added the comment:

Why is test.support.EnvironmentVarGuard preferable over 
distutils.test.support.EnvironGuard (with this one I'm not getting the warnings 
below)?

If I change the patch to (not so different (?) as in other tests using 
EnvironmentVarGuard):

$hg diff
diff -r 2b212a8186e0 Lib/distutils/tests/test_bdist_rpm.py
--- a/Lib/distutils/tests/test_bdist_rpm.py Mon Sep 29 11:25:00 2014 -0400
+++ b/Lib/distutils/tests/test_bdist_rpm.py Mon Sep 29 21:11:25 2014 +0200
@@ -5,7 +5,7 @@
 import os
 import tempfile
 import shutil
-from test.support import run_unittest
+from test.support import run_unittest, EnvironmentVarGuard
 
 from distutils.core import Distribution
 from distutils.command.bdist_rpm import bdist_rpm
@@ -36,8 +36,11 @@
 super(BuildRpmTestCase, self).setUp()
 self.old_location = os.getcwd()
 self.old_sys_argv = sys.argv, sys.argv[:]
+self.env = EnvironmentVarGuard()
 
 def tearDown(self):
+self.env.__exit__()
+del self.env   
   
 os.chdir(self.old_location)
   
 sys.argv = self.old_sys_argv[0]
   
 sys.argv[:] = self.old_sys_argv[1] 
   
@@ -54,6 +57,7 @@   
   
 def test_quiet(self):  
   
 # let's create a package   
   
 tmp_dir = self.mkdtemp()   
   
+self.env['HOME'] = tmp_dir   # to confine dir '.rpmdb' creation
   
 pkg_dir = os.path.join(tmp_dir, 'foo') 
   
 os.mkdir(pkg_dir)  
   
 self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
@@ -96,6 +100,7 @@
 def test_no_optimize_flag(self):
 # let's create a package that brakes bdist_rpm
 tmp_dir = self.mkdtemp()
+self.env['HOME'] = tmp_dir   # to confine dir '.rpmdb' creation
 pkg_dir = os.path.join(tmp_dir, 'foo')
 os.mkdir(pkg_dir)
 self.write_file((pkg_dir, 'setup.py'), SETUP_PY)

I get the message:
[102/390] test_distutils
Warning -- threading._dangling was modified by test_distutils

Using EnvironmentVarGuard as context manager gives the same warning.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir

2014-09-28 Thread R. David Murray

R. David Murray added the comment:

Thanks for the report and patch.

You should use test.support.EnvironmentVarGuard to make the environment change 
temporary.

--
nosy: +r.david.murray
versions: +Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22512] 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on home dir

2014-09-28 Thread Francis MB

New submission from Francis MB:

Running the test suite or 'test_distutils' triggers the creation of the 
directory '.rpmdb'. I noticed that because somehow that directory was bad 
formed and got errors while running the test suite:

error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH:
Database environment version mismatch
error: cannot open Packages index using db5 -  (-30969)
error: cannot open Packages database in /home/ci/.rpmdb
error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH:
Database environment version mismatch
error: cannot open Packages index using db5 -  (-30969)
error: cannot open Packages database in /home/ci/.rpmdb
After moving that directory and running the suite again the directory 
reappeared (but that time, and since then, no errors occurred). It seems that 
'test_distutils.test_bdist_rpm' triggers that behavior. This seems to be due 
'rpm' having it so configured [1]. In my case:

$ rpm -v --showrc | grep '.rpmdb'
-14: _dbpath%(bash -c 'echo ~/.rpmdb')

Here is a patch that confines the creation of this directory to the temporal 
test directory.

Regards,
francis


[1] https://bugs.launchpad.net/rpm/+bug/1069350

--
components: Distutils, Tests
files: confine_hidden_rpmdb_dir_creation.patch
keywords: patch
messages: 22
nosy: dstufft, eric.araujo, francismb
priority: normal
severity: normal
status: open
title: 'test_distutils.test_bdist_rpm' causes creation of directory '.rpmdb' on 
home dir
type: behavior
versions: Python 3.5
Added file: 
http://bugs.python.org/file36750/confine_hidden_rpmdb_dir_creation.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com