aboutsummaryrefslogtreecommitdiff
blob: 0fc9469eadb292ecc8556e5f8698054892d7d59c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/python
#
# Copyright 2010 Brian Dolbec <brian.dolbec@gmail.com>
# Copyright 2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# $Header$

from __future__ import print_function

__version__= "0.0.1"
__author__ = "Brian Dolbec"
__email__ = "brian.dolbec@gmail.com"

#  Whole unit commented out for being broken
#  from getopt import gnu_getopt, GetoptError

#  import unittest
#  import os
#  import sys

#  import gentoolkit.pprinter as pp

#  from gentoolkit.eclean.clean import CleanUp


#  class Controllers(object):
#          """Contains controller methods for use in testing
#          the clean module methods"""

#          def __init__(self):
#                  self.gathered_data = []
#                  self.authorize = True
#                  self.authorize_list = []
#                  self.authorize_index = 0

#          def authorize_all_controller(self, size, key, clean_list):
#                  """data gatherering controller.

#                  @rtype: Boolean
#                  @returns: self.authorize which controls the cleaning method
#                  """
#                  self.gathered_data.append([size, key, clean_list])
#                  return self.authorize

#          def authorize_list_controller(self, size, key, clean_list):
#                  """data gathering and controller which
#                  authorizes acoring to a pre-determined list

#                  @rtype: Boolean
#                  @return self.authorize_list[self.authorize_index]"""
#                  self.gathered_data.append([size, key, clean_list])
#                  index = self.authorize_index
#                  self.authorize_index =+ 1
#                  return self.authorize_list[index]


#  class TestCleanUp(unittest.TestCase):
#          """Test module for the various CleanUp class methods

#          @param options: dict of module options
#          @param testdata: dict. of path and test parameters
#                          as created by the TestDirCreation class"""

#          def __init__(self, options, testdata):
#                  self.options = options
#                  self.tesdata = testdata


#          def test_symlink_clean():
#                  """Tests the symbolic link portion of the distfiles
#                  cleaning"""
#                  pass


#          def test_dist_clean():
#                  """Test the distfiles cleaning"""
#                  pass


#          def test_pkg_clean():
#                  """Test the packages cleaning"""
#                  pass


#          def test_pretend_clean():
#                  """Test the pretend_clean output"""
#                  controlller = Controllers().authorize_all_controller
#                  clean = CleanUp(controller)
#                  clean.pretend_clean(self.dist_clean)
#                  data = controller.gathered_data



#  def useage():
#          """output run options"""
#          print("Useage: test_clean [OPTONS] path=test-dir")
#          print(" where test-dir is the location to create and populate")
#          print("the testing distfiles and packages directories.")
#          print("All tests in this module test only the clean.py module functions")
#          print()
#          print("OPTIONS:")
#          print(" -a, --all         run all tests")
#          print(" -c, --clean       clean up any previous test dirs & files")
#          print(" -D, --distfiles   run the distfiles cleaning test")
#          print(" -k, --keep-dirs   keep the test directories and files after the test")
#          print(" -p, --pretend     run the test in pretend mode only")
#          print(" -P, --packages    run the packages cleaning test")
#          print(" -S, --symlinks    run the symlinks test")
#          print(" --path            the location to create the temporary distfiles")
#          print("                   and packages directories that will be test cleaned")
#          print(" --version         test module version")
#          print()


#  def parse_opts():
#          """Parse the options dict

#          @return options: dictionary of module options"""
#          try:
#                  opts, args = getopt(sys.argv[1:], 'acDkpPS', ["version",
#                          "help", "path=", "all", "distfiles", "packages",
#                          "pretend", "symlinks", "keep-dirs", "clean"])
#                  #print opts
#                  #print args
#          except GetoptError as e:
#                  print(e.msg, file=sys.stderr)
#                  usage()
#                  sys.exit(1)



#  def main(cmdline=False):
#          """parse options and run the tests"""

#          if cmdline:
#                  options = parse_opts()


#  if __name__ == "__main__":
#          """actually call main() if launched as a script"""
#          try:
#                  main(True)
#          except KeyboardInterrupt:
#                  print("Aborted.")
#                  sys.exit(130)
#          sys.exit(0)