Commits

William Deegan  committed fc95c3d

fixed test for update release to work in 2012 (and years thereafter). It had 2011 hardcoded in many places. Now it'll calculate the current year and use that instead

  • Participants
  • Parent commits 3a0fec1
  • Branches fix_update_release_tests_2012_01

Comments (0)

Files changed (1)

File test/update-release-info/update-release-info.py

 
 import TestRuntest
 
+# Needed to ensure we're using the correct year
+this_year=time.localtime()[0]
+
 TestSCons      = 'QMTest/TestSCons.py'             .split('/')
 README         = 'README'                          .split('/')
 ReleaseConfig  = 'ReleaseConfig'                   .split('/')
 """version_tuple = (2, 0, 0, 'final', 0)
 """,
 # Index 5: bad release date
-"""release_date = (2011, 12)
-""",
+"""release_date = (%d, 12)
+"""%this_year,
 # Index 6: release date (hhhh, mm, dd)
-"""release_date = (2011, 12, 21)
-""",
+"""release_date = (%d, 12, 21)
+"""%this_year,
 # Index 7: release date (hhhh, mm, dd, hh, mm, ss)
-"""release_date = (2011, 12, 21, 12, 21, 12)
-""",
+"""release_date = (%d, 12, 21, 12, 21, 12)
+"""%this_year,
 ]
 
 combo_error = \
 combo_strings[0] = combo_strings[1] + combo_strings[2] + combo_strings[3]
 
 combo_fail(0, 5, stdout =
-"""ERROR: Invalid release date (2011, 12)
-""")
+"""ERROR: Invalid release date (%d, 12)
+"""%this_year )
 
 def pave(path):
     path = path[:-1]
 RELEASE 2.0.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
 """, mode = 'r')
 
-years = ', '.join(map(str, range(2001, time.localtime()[0] + 1)))
+
+years = ', '.join(map(str, range(2001, this_year + 1)))
 test.must_match(SConstruct, """
 month_year = 'MONTH YEAR'
 copyright_years = %s
 
 # should get Python floors from TestSCons module.
 test.must_match(TestSCons, """
-copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011'
+copyright_years = '%s'
 default_version = '2.0.0.alpha.yyyymmdd'
 python_version_unsupported = (2, 3)
 python_version_deprecated = (2, 4)
-""", mode = 'r')
+"""%years, mode = 'r')
 
 # should get Python floors from TestSCons module.
 test.must_match(Main, """