public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH gentoolkit 1/3] ekeyword: Rename unit test so that it runs
@ 2020-12-21  3:25 Matt Turner
  2020-12-21  3:25 ` [gentoo-portage-dev] [PATCH gentoolkit 2/3] ekeyword: Fix unit test Matt Turner
  2020-12-21  3:25 ` [gentoo-portage-dev] [PATCH gentoolkit 3/3] eclean: Remove unneeded __init__ to enable pytest Matt Turner
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Turner @ 2020-12-21  3:25 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Matt Turner

unittests should be named test_*.py so that they are discoverable.

Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
 pym/gentoolkit/ekeyword/pytest.ini                              | 2 +-
 .../ekeyword/{ekeyword_unittest.py => test_ekeyword.py}         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
 rename pym/gentoolkit/ekeyword/{ekeyword_unittest.py => test_ekeyword.py} (99%)

diff --git a/pym/gentoolkit/ekeyword/pytest.ini b/pym/gentoolkit/ekeyword/pytest.ini
index 622c9d8..7e21bec 100644
--- a/pym/gentoolkit/ekeyword/pytest.ini
+++ b/pym/gentoolkit/ekeyword/pytest.ini
@@ -1,3 +1,3 @@
 [pytest]
 addopts = --cov
-python_files = *_unittest.py
+python_files = test_*.py
diff --git a/pym/gentoolkit/ekeyword/ekeyword_unittest.py b/pym/gentoolkit/ekeyword/test_ekeyword.py
similarity index 99%
rename from pym/gentoolkit/ekeyword/ekeyword_unittest.py
rename to pym/gentoolkit/ekeyword/test_ekeyword.py
index ef2e256..3d23585 100755
--- a/pym/gentoolkit/ekeyword/ekeyword_unittest.py
+++ b/pym/gentoolkit/ekeyword/test_ekeyword.py
@@ -12,7 +12,7 @@ import unittest
 
 import mock
 
-import ekeyword
+from gentoolkit.ekeyword import ekeyword
 
 
 TESTDIR = os.path.join(os.path.dirname(__file__), 'tests')
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-portage-dev] [PATCH gentoolkit 2/3] ekeyword: Fix unit test
  2020-12-21  3:25 [gentoo-portage-dev] [PATCH gentoolkit 1/3] ekeyword: Rename unit test so that it runs Matt Turner
@ 2020-12-21  3:25 ` Matt Turner
  2020-12-21  3:25 ` [gentoo-portage-dev] [PATCH gentoolkit 3/3] eclean: Remove unneeded __init__ to enable pytest Matt Turner
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Turner @ 2020-12-21  3:25 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Matt Turner

arch_status changed from a Dict[str] to Dict[Tuple[str, str]], but these
bits of test data were not updated. Update the examples while we're here
(e.g. arm64 is stable with stable profiles now).

Fixes: 459cfba47d25 (ekeyword: Use now-common load_profile_data() from eshowkw)
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
 pym/gentoolkit/ekeyword/test_ekeyword.py | 38 +++++++++++-------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/pym/gentoolkit/ekeyword/test_ekeyword.py b/pym/gentoolkit/ekeyword/test_ekeyword.py
index 3d23585..12a0b54 100755
--- a/pym/gentoolkit/ekeyword/test_ekeyword.py
+++ b/pym/gentoolkit/ekeyword/test_ekeyword.py
@@ -165,28 +165,26 @@ class TestProcessKeywords(unittest.TestCase):
 			ekeyword.Op(None, 'all', None),
 		)
 		arch_status = {
-			'alpha': None,
-			'arm': 'stable',
-			'arm64': 'exp',
-			'm68k': 'dev',
+			'alpha': ('stable', '~arch'),
+			'arm':   ('stable', 'arch'),
+			'm68k':  ('exp', '~arch'),
+			's390':  ('exp', 'arch'),
 		}
-		self._test('* ~alpha ~arm ~arm64 ~m68k ~mips ~arm-linux', ops,
-		           '* ~alpha arm ~arm64 ~m68k ~mips ~arm-linux', arch_status)
+		self._test('* ~alpha ~arm ~m68k ~mips ~s390 ~arm-linux', ops,
+		           '* ~alpha arm ~m68k ~mips s390 ~arm-linux', arch_status)
 
 	def testAllUnstable(self):
 		ops = (
 			ekeyword.Op('~', 'all', None),
 		)
 		arch_status = {
-			'alpha': None,
-			'arm': 'stable',
-			'arm64': 'exp',
-			'm68k': 'dev',
-			's390': 'dev',
-			'sh': 'dev',
+			'alpha': ('stable', '~arch'),
+			'arm':   ('stable', 'arch'),
+			'm68k':  ('exp', '~arch'),
+			's390':  ('exp', 'arch'),
 		}
-		self._test('-* ~* * alpha arm arm64 m68k arm-linux', ops,
-		           '-* ~* * ~alpha ~arm ~arm64 ~m68k ~arm-linux', arch_status)
+		self._test('-* ~* * alpha arm m68k s390 arm-linux', ops,
+		           '-* ~* * ~alpha ~arm ~m68k ~s390 ~arm-linux', arch_status)
 
 	def testAllMultiUnstableStable(self):
 		ops = (
@@ -194,13 +192,13 @@ class TestProcessKeywords(unittest.TestCase):
 			ekeyword.Op(None, 'all', None),
 		)
 		arch_status = {
-			'alpha': None,
-			'arm': 'stable',
-			'arm64': 'exp',
-			'm68k': 'dev',
+			'alpha': ('stable', '~arch'),
+			'arm':   ('stable', 'arch'),
+			'm68k':  ('exp', '~arch'),
+			's390':  ('exp', 'arch'),
 		}
-		self._test('-* ~* * alpha arm arm64 m68k', ops,
-		           '-* ~* * ~alpha arm ~arm64 ~m68k', arch_status)
+		self._test('-* ~* * alpha arm m68k s390', ops,
+		           '-* ~* * ~alpha arm ~m68k s390', arch_status)
 
 	def testAllDisabled(self):
 		"""Make sure ~all does not change -arch to ~arch"""
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-portage-dev] [PATCH gentoolkit 3/3] eclean: Remove unneeded __init__ to enable pytest
  2020-12-21  3:25 [gentoo-portage-dev] [PATCH gentoolkit 1/3] ekeyword: Rename unit test so that it runs Matt Turner
  2020-12-21  3:25 ` [gentoo-portage-dev] [PATCH gentoolkit 2/3] ekeyword: Fix unit test Matt Turner
@ 2020-12-21  3:25 ` Matt Turner
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Turner @ 2020-12-21  3:25 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Matt Turner

Prevented the unit test from running:

pym/gentoolkit/test/eclean/distsupport.py:435: PytestCollectionWarning:
cannot collect test class 'TestDisfiles' because it has a __init__
constructor (from: pym/gentoolkit/test/eclean/test_search.py)

Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
 pym/gentoolkit/test/eclean/distsupport.py | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/pym/gentoolkit/test/eclean/distsupport.py b/pym/gentoolkit/test/eclean/distsupport.py
index 0fc2db8..da7cdbb 100644
--- a/pym/gentoolkit/test/eclean/distsupport.py
+++ b/pym/gentoolkit/test/eclean/distsupport.py
@@ -434,12 +434,6 @@ class OutputSimulator:
 
 class TestDisfiles:
 
-	def __init__(self):
-		self.workdir = None
-		self.target_file = None
-		self.target_symlink = None
-		self.test_filepaths = None
-
 	def setUp(self):
 		# create the dist dir
 		self.tmpdir = mkdtemp()
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-21  3:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-21  3:25 [gentoo-portage-dev] [PATCH gentoolkit 1/3] ekeyword: Rename unit test so that it runs Matt Turner
2020-12-21  3:25 ` [gentoo-portage-dev] [PATCH gentoolkit 2/3] ekeyword: Fix unit test Matt Turner
2020-12-21  3:25 ` [gentoo-portage-dev] [PATCH gentoolkit 3/3] eclean: Remove unneeded __init__ to enable pytest Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox