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

Comments (0)

Files changed (1)

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, """
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.