Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
distutils.tests.test_bdist_rpm.BuildRpmTestCase Class Reference
Inheritance diagram for distutils.tests.test_bdist_rpm.BuildRpmTestCase:
Inheritance graph
[legend]
Collaboration diagram for distutils.tests.test_bdist_rpm.BuildRpmTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def test_quiet
def test_no_optimize_flag
def mkdtemp
def write_file
def create_dist
def get_logs
def clear_logs

Public Attributes

 old_location
 old_sys_argv
 old_cwd
 tempdirs
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type
 threshold
 logs
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

Definition at line 28 of file test_bdist_rpm.py.


Member Function Documentation

Definition at line 45 of file support.py.

00045 
00046     def clear_logs(self):
00047         self.logs = []
00048 

Here is the caller graph for this function:

def distutils.tests.support.TempdirManager.create_dist (   self,
  pkg_name = 'foo',
  kw 
) [inherited]
Will generate a test environment.

This function creates:
 - a Distribution instance using keywords
 - a temporary directory with a package structure

It returns the package directory and the distribution
instance.

Definition at line 92 of file support.py.

00092 
00093     def create_dist(self, pkg_name='foo', **kw):
00094         """Will generate a test environment.
00095 
00096         This function creates:
00097          - a Distribution instance using keywords
00098          - a temporary directory with a package structure
00099 
00100         It returns the package directory and the distribution
00101         instance.
00102         """
00103         tmp_dir = self.mkdtemp()
00104         pkg_dir = os.path.join(tmp_dir, pkg_name)
00105         os.mkdir(pkg_dir)
00106         dist = Distribution(attrs=kw)
00107 
00108         return pkg_dir, dist
00109 

Here is the call graph for this function:

Here is the caller graph for this function:

def distutils.tests.support.LoggingSilencer.get_logs (   self,
  levels 
) [inherited]

Definition at line 37 of file support.py.

00037 
00038     def get_logs(self, *levels):
00039         def _format(msg, args):
00040             if len(args) == 0:
00041                 return msg
00042             return msg % args
00043         return [_format(msg, args) for level, msg, args
00044                 in self.logs if level in levels]

Here is the call graph for this function:

Here is the caller graph for this function:

Create a temporary directory that will be cleaned up.

Returns the path of the directory.

Definition at line 69 of file support.py.

00069 
00070     def mkdtemp(self):
00071         """Create a temporary directory that will be cleaned up.
00072 
00073         Returns the path of the directory.
00074         """
00075         d = tempfile.mkdtemp()
00076         self.tempdirs.append(d)
00077         return d

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from distutils.tests.support.LoggingSilencer.

Definition at line 30 of file test_bdist_rpm.py.

00030 
00031     def setUp(self):
00032         super(BuildRpmTestCase, self).setUp()
00033         self.old_location = os.getcwd()
00034         self.old_sys_argv = sys.argv, sys.argv[:]

Here is the caller graph for this function:

Reimplemented from distutils.tests.support.LoggingSilencer.

Definition at line 35 of file test_bdist_rpm.py.

00035 
00036     def tearDown(self):
00037         os.chdir(self.old_location)
00038         sys.argv = self.old_sys_argv[0]
00039         sys.argv[:] = self.old_sys_argv[1]
00040         super(BuildRpmTestCase, self).tearDown()

Here is the caller graph for this function:

Definition at line 81 of file test_bdist_rpm.py.

00081 
00082     def test_no_optimize_flag(self):
00083 
00084         # XXX I am unable yet to make this test work without
00085         # spurious sdtout/stderr output under Mac OS X
00086         if sys.platform != 'linux2':
00087             return
00088 
00089         # http://bugs.python.org/issue1533164
00090         # this test will run only if the rpm command is found
00091         if (find_executable('rpm') is None or
00092             find_executable('rpmbuild') is None):
00093             return
00094 
00095         # let's create a package that brakes bdist_rpm
00096         tmp_dir = self.mkdtemp()
00097         pkg_dir = os.path.join(tmp_dir, 'foo')
00098         os.mkdir(pkg_dir)
00099         self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
00100         self.write_file((pkg_dir, 'foo.py'), '#')
00101         self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
00102         self.write_file((pkg_dir, 'README'), '')
00103 
00104         dist = Distribution({'name': 'foo', 'version': '0.1',
00105                              'py_modules': ['foo'],
00106                              'url': 'xxx', 'author': 'xxx',
00107                              'author_email': 'xxx'})
00108         dist.script_name = 'setup.py'
00109         os.chdir(pkg_dir)
00110 
00111         sys.argv = ['setup.py']
00112         cmd = bdist_rpm(dist)
00113         cmd.fix_python = True
00114 
00115         cmd.quiet = 1
00116         cmd.ensure_finalized()
00117         cmd.run()
00118 
00119         dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
00120         self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
00121         os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))

Here is the call graph for this function:

Definition at line 41 of file test_bdist_rpm.py.

00041 
00042     def test_quiet(self):
00043 
00044         # XXX I am unable yet to make this test work without
00045         # spurious sdtout/stderr output under Mac OS X
00046         if sys.platform != 'linux2':
00047             return
00048 
00049         # this test will run only if the rpm commands are found
00050         if (find_executable('rpm') is None or
00051             find_executable('rpmbuild') is None):
00052             return
00053 
00054         # let's create a package
00055         tmp_dir = self.mkdtemp()
00056         pkg_dir = os.path.join(tmp_dir, 'foo')
00057         os.mkdir(pkg_dir)
00058         self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
00059         self.write_file((pkg_dir, 'foo.py'), '#')
00060         self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
00061         self.write_file((pkg_dir, 'README'), '')
00062 
00063         dist = Distribution({'name': 'foo', 'version': '0.1',
00064                              'py_modules': ['foo'],
00065                              'url': 'xxx', 'author': 'xxx',
00066                              'author_email': 'xxx'})
00067         dist.script_name = 'setup.py'
00068         os.chdir(pkg_dir)
00069 
00070         sys.argv = ['setup.py']
00071         cmd = bdist_rpm(dist)
00072         cmd.fix_python = True
00073 
00074         # running in quiet mode
00075         cmd.quiet = 1
00076         cmd.ensure_finalized()
00077         cmd.run()
00078 
00079         dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
00080         self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)

Here is the call graph for this function:

def distutils.tests.support.TempdirManager.write_file (   self,
  path,
  content = 'xxx' 
) [inherited]
Writes a file in the given path.


path can be a string or a sequence.

Definition at line 78 of file support.py.

00078 
00079     def write_file(self, path, content='xxx'):
00080         """Writes a file in the given path.
00081 
00082 
00083         path can be a string or a sequence.
00084         """
00085         if isinstance(path, (list, tuple)):
00086             path = os.path.join(*path)
00087         f = open(path, 'w')
00088         try:
00089             f.write(content)
00090         finally:
00091             f.close()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 25 of file support.py.

Definition at line 107 of file object.h.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 57 of file support.py.

Definition at line 32 of file test_bdist_rpm.py.

Definition at line 33 of file test_bdist_rpm.py.

Definition at line 58 of file support.py.

Definition at line 19 of file support.py.


The documentation for this class was generated from the following file: