[gentoo-commits] proj/layman:master commit in: layman/tests/

2020-04-24 Thread Brian Dolbec
commit: c381b3ff58236f4243bfec6eb206cbee968d8779
Author: Brian Dolbec  gentoo  org>
AuthorDate: Fri Apr 24 12:33:00 2020 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Fri Apr 24 13:54:16 2020 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=c381b3ff

test/external.py: Remove __future__ imports

Remove unused resetwarnings() call since unittest.main() does a sys.exit()

Signed-off-by: Brian Dolbec  gentoo.org>

 layman/tests/external.py | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index f2b18cd..e6f408d 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -14,9 +14,6 @@
 # Sebastian Pipping 
 #
 
-from __future__ import print_function
-from __future__ import unicode_literals
-
 '''Runs external (non-doctest) test cases.'''
 
 import os
@@ -452,7 +449,7 @@ class FetchRemoteList(unittest.TestCase):
 available = api.get_available()
 self.assertEqual(available, ['wrobel', 'wrobel-stable'])
 
-
+
 # Test the info of an overlay.
 info = api.get_info_str(['wrobel'], verbose=True, local=False)
 test_info = 'wrobel\n~~\nSource  : https://overlays.gentoo.org'\
@@ -769,4 +766,3 @@ class RemoteDBCache(unittest.TestCase):
 if __name__ == '__main__':
 filterwarnings('ignore')
 unittest.main()
-resetwarnings()



[gentoo-commits] proj/layman:master commit in: layman/tests/, layman/tests/testfiles/, layman/

2015-08-27 Thread Devan Franchini
commit: 794f56f5ae531a5b24200ad3c0d6cf7112305da8
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Fri Aug 28 03:37:32 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Aug 28 03:40:15 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=794f56f5

Deprecates get_all_info() function

The api function get_all_info() is being deprecated as it was much
slower than the get_info_str() function and was no longer used in
layman's code. The only instance found making use of it was older test
code which has been changed to also use the get_info_str() function.

external.py: Deprecates the get_all_info() function and adds multiple
owner testing compatibility.
api.py: Removes the get_all_info() function.
cli.py: Removes commented out use of get_all_info() function.
global-overlays.json: Changes structure of 'owner' attribute to reflect
changes for multiple owner support.

 layman/api.py   | 69 -
 layman/cli.py   |  6 ---
 layman/tests/external.py| 40 ++---
 layman/tests/testfiles/global-overlays.json | 12 +++--
 4 files changed, 22 insertions(+), 105 deletions(-)

diff --git a/layman/api.py b/layman/api.py
index 0718dce..20fe402 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -237,75 +237,6 @@ class LaymanAPI(object):
 return True
 
 
-def get_all_info(self, repos, local=False):
-retrieves the recorded information about the repo(s)
-specified by repo-id
-
-@type repos: list of strings or string
-@param repos: ['repo-id1', ...] or 'repo-id'
-@rtype list of tuples [(str, bool, bool),...]
-@return: dictionary of dictionaries
-{'ovl1':
-{'name': str,
-'owner_name': str,
-'owner_email': str,
-' homepage': str,
-'description': str,
-'src_uris': list of str ['uri1',...]
-'src_type': str,
-'priority': int,
-'quality': str
-'status':,
-'official': bool,
-'supported': bool,
-},
-'ovl2': {...}
-}
-
-
-repos = self._check_repo_type(repos, get_info)
-result = {}
-
-if local:
-db = self._get_installed_db()
-else:
-db = self._get_remote_db()
-
-for ovl in repos:
-if not self.is_repo(ovl):
-self.output.error(UnknownOverlayMessage(ovl))
-result[ovl] = ('', False, False)
-continue
-try:
-overlay = db.select(ovl)
-except UnknownOverlayException as error:
-self._error(error)
-result[ovl] = ('', False, False)
-else:
-result[ovl] = {
-'name': overlay.name,
-'owner_name': overlay.owner_name,
-'owner_email': overlay.owner_email,
-'homepage': overlay.homepage,
-'irc': overlay.irc,
-'description': [e for e in overlay.descriptions],
-'feeds': overlay.feeds,
-'sources': [(e.src, e.type, e.branch) \
-for e in overlay.sources],
-#'src_uris': [e.src for e in overlay.sources],
-'src_uris': overlay.source_uris(),
-'src_types': overlay.source_types(),
-#'src_types': [e.type for e in overlay.sources],
-'priority': overlay.priority,
-'quality': overlay.quality,
-'status': overlay.status,
-'official': overlay.is_official(),
-'supported': overlay.is_supported(),
-}
-
-return result
-
-
 def get_info_str(self, repos, local=True, verbose=False, width=0):
 retrieves the string representation of the recorded information
 about the repo(s) specified by ovl

diff --git a/layman/cli.py b/layman/cli.py
index bb9ea6f..86d6e70 100644
--- a/layman/cli.py
+++ b/layman/cli.py
@@ -381,17 +381,11 @@ class Main(object):
 self.output.debug('Printing installed overlays.', 6)
 list_printer = ListPrinter(self.config)
 
-#
-# fast way
 info = self.api.get_info_list(verbose=self.config['verbose'],
   width=list_printer.width)
 #self.output.debug('CLI: ListLocal() info = %s' % len(info), 4)
 #self.output.debug('\n'.join([ str(x) for x in info]), 4)
 list_printer.print_shortlist(info, complain=True)
-#
-# slow way
-#info = self.api.get_all_info(self.api.get_installed(), local=True)
-#list_printer.print_fulldict(info, complain=_complain)
 
 # blank newline  -- no  *
 

[gentoo-commits] proj/layman:master commit in: layman/tests/testfiles/, layman/, layman/tests/

2015-07-20 Thread Devan Franchini
commit: e8160e953d4c1c9792c8640fd3edbe6ac1d39e9e
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Mon Jul 20 13:57:09 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Mon Jul 20 13:57:11 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=e8160e95

external.py: Adds json DB testing

updater.py: Adds proper line spacing for database migration output

 layman/tests/external.py| 28 ++
 layman/tests/testfiles/global-overlays.json | 44 +
 layman/updater.py   |  2 +-
 3 files changed, 73 insertions(+), 1 deletion(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index e9f419a..f61d4b6 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -673,6 +673,7 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
 
 def read_db(self):
 output = Message()
+# First test if XML databasing works.
 config = {'output': output,
   'db_type': 'xml',}
 db = DbBase(config, [HERE + '/testfiles/global-overlays.xml', ])
@@ -682,6 +683,15 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
 url = ['rsync://gunnarwrobel.de/wrobel-stable']
 self.assertEqual(list(db.overlays['wrobel-stable'].source_uris()), url)
 
+# Test JSON databasing after.
+config['db_type'] = 'json'
+db = DbBase(config, [HERE + '/testfiles/global-overlays.json', ])
+keys = sorted(db.overlays)
+self.assertEqual(keys, ['twitch153', 'wrobel-stable'])
+
+url = ['git://github.com/twitch153/ebuilds.git']
+self.assertEqual(list(db.overlays['twitch153'].source_uris()), url)
+
 
 def select_db(self):
 output = Message()
@@ -691,10 +701,16 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
 url = ['rsync://gunnarwrobel.de/wrobel-stable']
 self.assertEqual(list(db.select('wrobel-stable').source_uris()), url)
 
+config['db_type'] = 'json'
+db = DbBase(config, [HERE + '/testfiles/global-overlays.json', ])
+url = ['git://github.com/twitch153/ebuilds.git']
+self.assertEqual(list(db.select('twitch153').source_uris()), url)
+
 
 def write_db(self):
 tmpdir = tempfile.mkdtemp(prefix='laymantmp_')
 test_xml = os.path.join(tmpdir, 'test.xml')
+test_json = os.path.join(tmpdir, 'test.json')
 config = BareConfig()
 
 a = DbBase(config, [HERE + '/testfiles/global-overlays.xml', ])
@@ -707,8 +723,20 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
 keys = sorted(c.overlays)
 self.assertEqual(keys, ['wrobel-stable'])
 
+config.set_option('db_type', 'json')
+a = DbBase(config, [HERE + '/testfiles/global-overlays.json', ])
+b = DbBase({'output': Message(), 'db_type': 'json'}, [test_json,])
+
+b.overlays['twitch153'] = a.overlays['twitch153']
+b.write(test_json)
+
+c = DbBase({'output': Message(), 'db_type': 'json'}, [test_json,])
+keys = sorted(c.overlays)
+self.assertEqual(keys, ['twitch153'])
+
 # Clean up:
 os.unlink(test_xml)
+os.unlink(test_json)
 shutil.rmtree(tmpdir)
 
 

diff --git a/layman/tests/testfiles/global-overlays.json 
b/layman/tests/testfiles/global-overlays.json
new file mode 100644
index 000..53267cf
--- /dev/null
+++ b/layman/tests/testfiles/global-overlays.json
@@ -0,0 +1,44 @@
+{
+  @encoding: unicode,
+  @version: 1.0,
+  repo: [
+{
+  @priority: 40,
+  @quality: experimental,
+  @status: unofficial,
+  description: [
+Twitch test
+  ],
+  feed: [
+https://github.com/twitch153/ebuilds/commits/master.atom;
+  ],
+  homepage: https://github.com/twitch153/ebuilds;,
+  name: twitch153,
+  owner: {
+email: twitch...@gentoo.org,
+name: Devan Franchini
+  },
+  source: [
+{
+  #text: git://github.com/twitch153/ebuilds.git,
+  @type: git
+}
+  ]
+},
+{
+  description: [
+A collection of ebuilds from Gunnar Wrobel [wro...@gentoo.org].
+  ],
+  name: wrobel-stable,
+  owner: {
+email: nob...@gentoo.org
+  },
+  source: [
+{
+  #text: rsync://gunnarwrobel.de/wrobel-stable,
+  @type: rsync
+}
+  ]
+}
+  ]
+}

diff --git a/layman/updater.py b/layman/updater.py
index 9d7b176..746373d 100644
--- a/layman/updater.py
+++ b/layman/updater.py
@@ -158,7 +158,7 @@ class Main(object):
 raise err
 
 msg = '  Successfully migrated database from %(from_type)s to '\
-  '%(to_type)s\n' % {'from_type': self.config['db_type'],
+  ' %(to_type)s\n' % {'from_type': self.config['db_type'],
'to_type': migrate_type}
 self.output.info(msg)
 



[gentoo-commits] proj/layman:master commit in: layman/tests/

2015-07-14 Thread Devan Franchini
commit: 7428f47c435073a929f9a41f72a6bd8a675b631e
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Tue Jul 14 13:30:16 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Tue Jul 14 13:30:37 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=7428f47c

external.py: Adds db_type config option to tests which need it

The Overlay, DbBase, and DB would require the db_type config option
to be set. To prevent it from falling back on config option defaults
it's best to specify it.

 layman/tests/external.py | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index 0dad278..3e41bd1 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -154,6 +154,7 @@ class AddDeleteDB(unittest.TestCase):
 
 my_opts = {'installed' : temp_xml_path,
'conf_type' : ['make.conf', 'repos.conf'],
+   'db_type'   : 'xml_db',
'nocheck'   : 'yes',
'make_conf' : make_conf,
'repos_conf': repo_conf,
@@ -480,6 +481,7 @@ class FormatBranchCategory(unittest.TestCase):
 def _run(self, number):
 #config = {'output': Message()}
 config = BareConfig()
+
 # Discuss renaming files to branch-%d.xml
 filename1 = os.path.join(HERE, 'testfiles',
 'subpath-%d.xml' % number)
@@ -554,7 +556,7 @@ class OverlayObjTest(unittest.TestCase):
 overlays = document.findall('overlay') + document.findall('repo')
 output = Message()
 
-ovl_a = Overlay({'output': output}, overlays[0])
+ovl_a = Overlay({'output': output, 'db_type': 'xml_db'}, 
xml=overlays[0])
 self.assertEqual(ovl_a.name, 'wrobel')
 self.assertEqual(ovl_a.is_official(), True)
 url = ['https://overlays.gentoo.org/svn/dev/wrobel']
@@ -563,7 +565,7 @@ class OverlayObjTest(unittest.TestCase):
 self.assertEqual(ovl_a.descriptions, ['Test'])
 self.assertEqual(ovl_a.priority, 10)
 
-ovl_b = Overlay({'output': output}, overlays[1])
+ovl_b = Overlay({'output': output, 'db_type': 'xml_db'}, 
xml=overlays[1])
 self.assertEqual(ovl_b.is_official(), False)
 
 
@@ -572,7 +574,7 @@ class OverlayObjTest(unittest.TestCase):
 overlays = document.findall('overlay') + document.findall('repo')
 output = Message()
 
-ovl = Overlay({'output': output}, overlays[0])
+ovl = Overlay({'output': output, 'db_type': 'xml_db'}, xml=overlays[0])
 test_infostr = 'wrobel\n~~\nSource  : '\
'https://overlays.gentoo.org/svn/dev/wrobel\nContact '\
': nob...@gentoo.org\nType: Subversion; Priority: '\
@@ -586,7 +588,7 @@ class OverlayObjTest(unittest.TestCase):
 overlays = document.findall('overlay') + document.findall('repo')
 output = Message()
 
-ovl = Overlay({'output': output}, overlays[0])
+ovl = Overlay({'output': output, 'db_type': 'xml_db'}, xml=overlays[0])
 test_short_list = 'wrobel[Subversion] '\
   '(https://o.g.o/svn/dev/wrobel )'
 self.assertEqual(ovl.short_list(80).decode('utf-8'), test_short_list)



[gentoo-commits] proj/layman:master commit in: layman/tests/

2015-07-14 Thread Devan Franchini
commit: c8783443cc42d4254d4b2a71796202495487fe0f
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Tue Jul 14 13:32:33 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Tue Jul 14 13:32:33 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=c8783443

external.py: Modifies ovl_dict keys to conform to new changes

 layman/tests/external.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index 3e41bd1..01cf5b3 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -522,11 +522,11 @@ class MakeOverlayXML(unittest.TestCase):
 
 ovl_dict = {
 'name': 'wrobel',
-'descriptions': ['Test'],
+'description': ['Test'],
 'owner_name': 'nobody',
 'owner_email': 'nob...@gentoo.org',
 'status': 'official',
-'sources': [['https://overlays.gentoo.org/svn/dev/wrobel',
+'source': [['https://overlays.gentoo.org/svn/dev/wrobel',
  'svn', '']],
 'priority': '10',
}



[gentoo-commits] proj/layman:master commit in: layman/tests/

2015-07-09 Thread Devan Franchini
commit: 218a9cbf948a70d852d1fe0e22322003d2f0b6dd
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Thu Jul  9 17:20:20 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Thu Jul  9 17:20:20 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=218a9cbf

external.py: Adds db_type to configs for DbBase tests

 layman/tests/external.py | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index 97bd6ee..e2a44b0 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -637,6 +637,7 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
 output = Message()
 config = {
   'output': output,
+  'db_type': 'xml',
   'svn_command': '/usr/bin/svn',
   'rsync_command':'/usr/bin/rsync'
  }
@@ -670,7 +671,8 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
 
 def read_db(self):
 output = Message()
-config = {'output': output}
+config = {'output': output,
+  'db_type': 'xml',}
 db = DbBase(config, [HERE + '/testfiles/global-overlays.xml', ])
 keys = sorted(db.overlays)
 self.assertEqual(keys, ['wrobel', 'wrobel-stable'])
@@ -681,7 +683,8 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
 
 def select_db(self):
 output = Message()
-config = {'output': output}
+config = {'output': output,
+  'db_type': 'xml',}
 db = DbBase(config, [HERE + '/testfiles/global-overlays.xml', ])
 url = ['rsync://gunnarwrobel.de/wrobel-stable']
 self.assertEqual(list(db.select('wrobel-stable').source_uris()), url)
@@ -691,13 +694,14 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
 tmpdir = tempfile.mkdtemp(prefix='laymantmp_')
 test_xml = os.path.join(tmpdir, 'test.xml')
 config = BareConfig()
+
 a = DbBase(config, [HERE + '/testfiles/global-overlays.xml', ])
-b = DbBase({'output': Message()}, [test_xml,])
+b = DbBase({'output': Message(), 'db_type': 'xml'}, [test_xml,])
 
 b.overlays['wrobel-stable'] = a.overlays['wrobel-stable']
 b.write(test_xml)
 
-c = DbBase({'output': Message()}, [test_xml,])
+c = DbBase({'output': Message(), 'db_type': 'xml'}, [test_xml,])
 keys = sorted(c.overlays)
 self.assertEqual(keys, ['wrobel-stable'])
 



[gentoo-commits] proj/layman:master commit in: layman/tests/

2015-07-09 Thread Devan Franchini
commit: 0099095fd231d70b3f7e21bd7df7cbdac3c13d90
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Thu Jul  9 15:29:20 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Thu Jul  9 15:29:20 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=0099095f

external.py: Adds db_type to list of test config keys

 layman/tests/external.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index f8bcc8c..97bd6ee 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -345,7 +345,7 @@ class CLIArgs(unittest.TestCase):
  'custom_news_pkg', 'cvs_addopts', 'cvs_command',
  'cvs_postsync', 'cvs_syncopts', 'darcs_addopts',
  'darcs_command', 'darcs_postsync', 'darcs_syncopts',
- 'g-common_command', 'g-common_generateopts',
+ 'db_type', 'g-common_command', 'g-common_generateopts',
  'g-common_postsync', 'g-common_syncopts',
  'g-sorcery_command', 'g-sorcery_generateopts',
  'g-sorcery_postsync', 'g-sorcery_syncopts', 'git_addopts',



[gentoo-commits] proj/layman:master commit in: layman/tests/

2015-06-15 Thread Devan Franchini
commit: acf5162dc04352e1a4f2b6719157e5bedc7fb2fc
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Tue Jun 16 01:28:18 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Tue Jun 16 01:29:01 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=acf5162d

external.py: Renames test function to more appropriate name

Renames AddDeleteEnableDisableFromDB to AddDeleteEnableDisableFromConf
as the test is mainly testing the functionality of the conf files,
not the database classes.

 layman/tests/external.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index eaa3510..713923b 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -53,7 +53,7 @@ if encoding != 'utf-8':
 
 HERE = os.path.dirname(os.path.realpath(__file__))
 
-class AddDeleteEnableDisableFromDB(unittest.TestCase):
+class AddDeleteEnableDisableFromConf(unittest.TestCase):
 
 def test(self):
 tmpdir = tempfile.mkdtemp(prefix='laymantmp_')



[gentoo-commits] proj/layman:master commit in: layman/tests/, layman/

2015-06-15 Thread Devan Franchini
commit: e6ff4558bedecb6e47700c815f8b6462ec02773f
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Tue Jun 16 03:34:58 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Tue Jun 16 03:35:01 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=e6ff4558

external.py: Adds AddDeleteDB test

db.py: Removes docstring tests in favor of external test suite.

 layman/db.py | 100 +--
 layman/tests/external.py |  90 ++
 2 files changed, 91 insertions(+), 99 deletions(-)

diff --git a/layman/db.py b/layman/db.py
index add8fa1..ba7399c 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -107,52 +107,7 @@ class DB(DbBase):
 def add(self, overlay):
 '''
 Add an overlay to the local list of overlays.
-
- import tempfile
- tmpdir = tempfile.mkdtemp(prefix=laymantmp_)
- write = os.path.join(tmpdir, 'installed.xml')
- write2 = os.path.join(tmpdir, 'make.conf')
- here = os.path.dirname(os.path.realpath(__file__))
- from layman.config import OptionConfig
- myoptions = {'installed' :
-...   here + '/tests/testfiles/global-overlays.xml',
-...   'local_list': here + '/tests/testfiles/overlays.xml',
-...   'make_conf' : write2,
-...   'nocheck': 'yes',
-...   'storage'   : tmpdir}
-
- config = OptionConfig(myoptions)
- config.set_option('quietness', 3)
- a = DB(config)
- config.set_option('installed', write)
- b = DB(config)
- config['output'].set_colorize(False)
-
- m = MakeConf(config, b.overlays)
- m.path = write2
- success = m.write()
- success
-True
-
-# Commented out since it needs network access:
-
-#  b.add(a.select('wrobel-stable')) #doctest: +ELLIPSIS
-# * Running command /usr/bin/rsync -rlptDvz --progress --delete 
--delete-after --timeout=180 --exclude=distfiles/* --exclude=local/* 
--exclude=packages/* rsync://gunnarwrobel.de/wrobel-stable/* 
/tmp/file.../wrobel-stable...
-#  c = DbBase([write, ], dict())
-#  c.overlays.keys()
-# ['wrobel-stable']
-
-#  m = MakeConf(config, b.overlays)
-#  [i.name for i in m.overlays] #doctest: +ELLIPSIS
-# ['wrobel-stable']
-
-#  os.unlink(write)
- os.unlink(write2)
-
- import shutil
- shutil.rmtree(tmpdir)
 '''
-
 if overlay.name not in self.overlays.keys():
 if not self._check_official(overlay):
 return False
@@ -188,61 +143,8 @@ class DB(DbBase):
 
 def delete(self, overlay):
 '''
-Add an overlay to the local list of overlays.
-
- import tempfile
- tmpdir = tempfile.mkdtemp(prefix=laymantmp_)
- write = os.path.join(tmpdir, 'installed.xml')
- write2 = os.path.join(tmpdir, 'make.conf')
- here = os.path.dirname(os.path.realpath(__file__))
- from layman.config import OptionConfig
- myoptions = {'installed' :
-...   here + '/tests/testfiles/global-overlays.xml',
-...   'local_list': here + '/tests/testfiles/overlays.xml',
-...   'make_conf' : write2,
-...   'nocheck': 'yes',
-...   'storage'   : tmpdir}
-
- config = OptionConfig(myoptions)
- config.set_option('quietness', 3)
- a = DB(config)
- config.set_option('installed', write)
- b = DB(config)
- config['output'].set_colorize(False)
-
- m = MakeConf(config, b.overlays)
- m.path = here + '/tests/testfiles/make.conf'
- m.read()
-True
-
- m.path = write2
- m.write()
-True
-
-#  b.add(a.select('wrobel-stable')) #doctest: +ELLIPSIS
-# * Running command /usr/bin/rsync -rlptDvz --progress --delete 
--delete-after --timeout=180 --exclude=distfiles/* --exclude=local/* 
--exclude=packages/* rsync://gunnarwrobel.de/wrobel-stable/* 
/tmp/file.../wrobel-stable...
-#  b.add(a.select('wrobel')) #doctest: +ELLIPSIS
-# * Running command /usr/bin/svn co 
https://overlays.gentoo.org/svn/dev/wrobel/; /tmp/file.../wrobel...
-#  c = DbBase([write, ], dict())
-#  c.overlays.keys()
-# ['wrobel', 'wrobel-stable']
-
-#  b.delete(b.select('wrobel'))
-#  c = DbBase([write, ], dict())
-#  c.overlays.keys()
-# ['wrobel-stable']
-
-#  m = MakeConf(config, b.overlays)
-#  [i.name for i in m.overlays] #doctest: +ELLIPSIS
-# ['wrobel-stable']
-
-#  os.unlink(write)
- os.unlink(write2)
-
- import shutil
- shutil.rmtree(tmpdir)
+Delete an overlay from the local list of overlays.
 '''
-
 if 

[gentoo-commits] proj/layman:master commit in: layman/tests/

2015-03-27 Thread Devan Franchini
commit: 18e0e25f18745a507a25b175986b855e0ec996a9
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Fri Mar 27 20:50:17 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Mar 27 20:50:17 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=18e0e25f

external.py: Adds protocol_filter to keys to test for CLIArgs test

 layman/tests/external.py | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index ad630e6..d9ef858 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -258,14 +258,13 @@ class CLIArgs(unittest.TestCase):
  'make_conf', 'mercurial_addopts', 'mercurial_command',
  'mercurial_postsync', 'mercurial_syncopts',
  'news_reporter', 'nocheck', 'overlay_defs', 'overlays',
- 'quietness', 'repos_conf', 'require_repoconfig',
- 'rsync_command', 'rsync_postsync', 'rsync_syncopts',
- 'squashfs_addopts', 'squashfs_command',
- 'squashfs_postsync', 'squashfs_syncopts',
- 'storage', 'support_url_updates', 'svn_addopts',
- 'svn_command', 'svn_postsync', 'svn_syncopts',
- 't/f_options', 'tar_command', 'tar_postsync', 'umask',
- 'width']
+ 'protocol_filter', 'quietness', 'repos_conf',
+ 'require_repoconfig', 'rsync_command', 'rsync_postsync',
+ 'rsync_syncopts', 'squashfs_addopts', 'squashfs_command',
+ 'squashfs_postsync', 'squashfs_syncopts', 'storage',
+ 'support_url_updates', 'svn_addopts', 'svn_command',
+ 'svn_postsync', 'svn_syncopts', 't/f_options',
+ 'tar_command', 'tar_postsync', 'umask', 'width']
 # Due to this not being a dict object, the keys() invocation is needed.
 self.assertEqual(sorted(a.keys()), test_keys)
 



[gentoo-commits] proj/layman:master commit in: layman/tests/

2015-03-27 Thread Devan Franchini
commit: 7011c1ec70ad98f818f3fc7b549c3dae8f5ad1da
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Fri Mar 27 21:37:58 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Mar 27 21:37:58 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=7011c1ec

external.py: Adds __future__ import for unicode_literals

 layman/tests/external.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index d9ef858..64a4263 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -15,6 +15,7 @@
 #
 
 from __future__ import print_function
+from __future__ import unicode_literals
 
 '''Runs external (non-doctest) test cases.'''
 



[gentoo-commits] proj/layman:master commit in: layman/tests/

2015-03-27 Thread Devan Franchini
commit: c782c43b14d71766ed22b9eb39c6bd5bec9a264c
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Fri Mar 27 22:02:48 2015 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Fri Mar 27 22:02:51 2015 +
URL:https://gitweb.gentoo.org/proj/layman.git/commit/?id=c782c43b

external.py: Attempts to set default string encoding to utf-8

X-Gentoo-Bug: 539416
X-Gentoo-Bug-URL: https://bugs.gentoo.org/539416

 layman/tests/external.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index 64a4263..eaa3510 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -45,6 +45,12 @@ from  layman.repoconfmanager  import RepoConfManager
 from  layman.utilsimport path
 from  warnings import filterwarnings, resetwarnings
 
+encoding = sys.getdefaultencoding()
+
+if encoding != 'utf-8':
+reload(sys)
+sys.setdefaultencoding('utf-8')
+
 HERE = os.path.dirname(os.path.realpath(__file__))
 
 class AddDeleteEnableDisableFromDB(unittest.TestCase):



[gentoo-commits] proj/layman:master commit in: layman/tests/

2014-12-03 Thread Devan Franchini
commit: 561623c9edcf1b7890dee4a9eaf808774a05db26
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun Nov 30 06:06:26 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Sun Nov 30 06:06:26 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=561623c9

external.py: Modifies tested flags to reflect new config options

---
 layman/tests/external.py | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index 70d5b62..695decc 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -241,17 +241,18 @@ class CLIArgs(unittest.TestCase):
 a = ArgsParser()
 test_url = 'https://api.gentoo.org/overlays/repositories.xml'
 self.assertTrue(test_url in a['overlays'].split('\n'))
+
 test_keys = ['auto_sync', 'bzr_addopts', 'bzr_command', 'bzr_postsync',
- 'bzr_syncopts', 'cache', 'clean_tar', 'conf_module',
- 'conf_type', 'config', 'configdir', 'custom_news_pkg',
- 'cvs_addopts', 'cvs_command', 'cvs_postsync',
- 'cvs_syncopts', 'darcs_addopts', 'darcs_command',
- 'darcs_postsync', 'darcs_syncopts', 'g-common_command',
- 'g-common_generateopts', 'g-common_postsync',
- 'g-common_syncopts', 'g-sorcery_command',
- 'g-sorcery_generateopts', 'g-sorcery_postsync',
- 'g-sorcery_syncopts', 'git_addopts', 'git_command',
- 'git_email', 'git_postsync', 'git_syncopts',
+ 'bzr_syncopts', 'cache', 'check_official', 
'clean_archive',
+ 'conf_module', 'conf_type', 'config', 'configdir',
+ 'custom_news_pkg', 'cvs_addopts', 'cvs_command',
+ 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts',
+ 'darcs_command', 'darcs_postsync', 'darcs_syncopts',
+ 'g-common_command', 'g-common_generateopts',
+ 'g-common_postsync', 'g-common_syncopts',
+ 'g-sorcery_command', 'g-sorcery_generateopts',
+ 'g-sorcery_postsync', 'g-sorcery_syncopts', 'git_addopts',
+ 'git_command', 'git_email', 'git_postsync', 
'git_syncopts',
  'git_user', 'gpg_detached_lists', 'gpg_signed_lists',
  'http_proxy', 'https_proxy', 'installed', 'local_list',
  'make_conf', 'mercurial_addopts', 'mercurial_command',
@@ -259,6 +260,8 @@ class CLIArgs(unittest.TestCase):
  'news_reporter', 'nocheck', 'overlay_defs', 'overlays',
  'quietness', 'repos_conf', 'require_repoconfig',
  'rsync_command', 'rsync_postsync', 'rsync_syncopts',
+ 'squashfs_addopts', 'squashfs_command',
+ 'squashfs_postsync', 'squashfs_syncopts',
  'storage', 'support_url_updates', 'svn_addopts',
  'svn_command', 'svn_postsync', 'svn_syncopts',
  't/f_options', 'tar_command', 'tar_postsync', 'umask',



[gentoo-commits] proj/layman:master commit in: layman/tests/

2014-12-03 Thread Devan Franchini
commit: c84e88abaa0aff6bf7c41c2aea8ca09cf98cb4c2
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun Nov 30 04:19:37 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Sun Nov 30 04:44:33 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c84e88ab

external.py: Improves success checking in AddDeleteEnableDisableFromDB

---
 layman/tests/external.py | 28 +---
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index e20baaa..45b4d39 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -89,31 +89,20 @@ class AddDeleteEnableDisableFromDB(unittest.TestCase):
 # Add all the overlays in global_overlays.xml.
 for overlay in a.overlays.keys():
 conf_success = conf.add(a.overlays[overlay])
-if False in conf_success:
+if conf_success == False:
 success.append(False)
 else:
 success.append(True)
 
 # Disable one overlay.
-conf_success = conf.disable(a.overlays['wrobel'])
-if False in conf_success:
-success.append(False)
-else:
-success.append(True)
+self.assertTrue(conf.disable(a.overlays['wrobel']))
 
 # Enable disabled overlay.
-conf_success = conf.enable(a.overlays['wrobel'])
-if False in conf_success:
-success.append(False)
-else:
-success.append(True)
+self.assertTrue(conf.enable(a.overlays['wrobel']))
+
 # Delete all the overlays in global_overlays.xml.
 for overlay in a.overlays.keys():
-conf_success = conf.delete(a.overlays[overlay])
-if False in conf_success:
-success.append(False)
-else:
-success.append(True)
+self.assertTrue(conf.delete(a.overlays[overlay]))
 
 # Clean up.
 os.unlink(makeconf)
@@ -121,13 +110,6 @@ class AddDeleteEnableDisableFromDB(unittest.TestCase):
 
 shutil.rmtree(tmpdir)
 
-if False in success:
-success = False
-else:
-success = True
-
-self.assertTrue(success)
-
 
 # Tests archive overlay types (squashfs, tar)
 # http://bugs.gentoo.org/show_bug.cgi?id=304547



[gentoo-commits] proj/layman:master commit in: layman/tests/

2014-12-03 Thread Devan Franchini
commit: ad249e2fb0bf3a4ba3265e2f7f4d3cf3c34ab41b
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun Nov 30 04:56:47 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Sun Nov 30 04:56:47 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ad249e2f

external.py: Improves CLIArgs testing for a[overlays]

---
 layman/tests/external.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index 45b4d39..70d5b62 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -239,8 +239,8 @@ class CLIArgs(unittest.TestCase):
 
 # Test the passed in cli opts on the ArgsParser class:
 a = ArgsParser()
-test_url = '\n\nhttps://api.gentoo.org/overlays/repositories.xml'
-self.assertEqual(a['overlays'], test_url)
+test_url = 'https://api.gentoo.org/overlays/repositories.xml'
+self.assertTrue(test_url in a['overlays'].split('\n'))
 test_keys = ['auto_sync', 'bzr_addopts', 'bzr_command', 'bzr_postsync',
  'bzr_syncopts', 'cache', 'clean_tar', 'conf_module',
  'conf_type', 'config', 'configdir', 'custom_news_pkg',



[gentoo-commits] proj/layman:master commit in: layman/tests/

2014-12-03 Thread Devan Franchini
commit: c7e394dc49ee26fe52012befa30e08ce91270377
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun Nov 30 03:28:12 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Sun Nov 30 04:44:17 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c7e394dc

external.py: Converts all assertEquals calls to assertEqual

As the assertEquals call is being deprecated, all of its calls must
be converted to assertEqual.

---
 layman/tests/external.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index 64f48d2..e20baaa 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -645,7 +645,7 @@ class RemoteDBCache(unittest.TestCase):
   }
 config = OptionConfig(my_opts)
 db = RemoteDB(config)
-self.assertEquals(db.cache(), (True, True))
+self.assertEqual(db.cache(), (True, True))
 
 db_xml = fileopen(db.filepath(config['overlays']) + '.xml')
 



[gentoo-commits] proj/layman:master commit in: layman/tests/

2014-12-03 Thread Devan Franchini
commit: b61bee7bf4658940147cba1d7ed0dfbeb1a49696
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun Nov 30 02:57:32 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Sun Nov 30 02:57:36 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b61bee7b

external.py: Adds archive overlay test checking

A test has been added to ensure we only test the archive overlay
types that the user has installed on their system.

---
 layman/tests/external.py | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index 1aceca6..64f48d2 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -194,7 +194,16 @@ class ArchiveAddRemoveSync(unittest.TestCase):
 
 
 def test(self):
-for archive in ('squashfs', 'tar'):
+archives = []
+try:
+from layman.overlays.modules.tar.tar import TarOverlay
+archives.append('tar')
+from layman.overlays.modules.squashfs.squashfs import 
SquashfsOverlay
+archives.append('squashfs')
+except ImportError:
+pass
+
+for archive in archives:
 xml_text, repo_name, temp_archive_path = getattr(self,
 _create_%(archive)s_overlay %
 {'archive': archive})()



[gentoo-commits] proj/layman:master commit in: layman/tests/

2014-12-03 Thread Devan Franchini
commit: 6236bd0dbeb638c0c67c3e32a247eb55b000e3b8
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Sun Nov 30 06:20:17 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Sun Nov 30 06:20:17 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6236bd0d

external.py: Modifies XML line testing in MakeOverlayXML class

To make this testing more compliant with both py2.7 and py3.x the
method in which the test suit tested the lines in the made XML
needed to be changed as py2.7 adds the XML header when reading in
the XML test file.

---
 layman/tests/external.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index 695decc..ad630e6 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -444,7 +444,7 @@ class MakeOverlayXML(unittest.TestCase):
 with fileopen(path, 'r') as xml:
 test_line = 'source type=svn'\
 'https://overlays.gentoo.org/svn/dev/wrobel/source\n'
-self.assertEqual(xml.readlines()[9], test_line)
+self.assertTrue(test_line in xml.readlines())
 for line in xml.readlines():
 print(line, end='')
 



[gentoo-commits] proj/layman:master commit in: layman/tests/

2014-11-01 Thread Devan Franchini
commit: 0481082b1f8d53ee175567e37e9d0efaf1717c02
Author: Devan Franchini twitch153 AT gentoo DOT org
AuthorDate: Tue Oct 28 17:15:21 2014 +
Commit: Devan Franchini twitch153 AT gentoo DOT org
CommitDate: Sun Nov  2 03:14:47 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=0481082b

external.py: Spelling correction for header

---
 layman/tests/external.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/layman/tests/external.py b/layman/tests/external.py
index 21ad029..1aceca6 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
#
-# EXTENRAL LAYMAN TESTS
+# EXTERNAL LAYMAN TESTS
 
#
 # File:   external.py
 #