Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
c437f050
Commit
c437f050
authored
Jan 05, 2009
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the 'Cannot open version.txt' case testable.
parent
23e98680
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
lib/python/App/tests/test_version_txt.py
lib/python/App/tests/test_version_txt.py
+3
-0
lib/python/App/version_txt.py
lib/python/App/version_txt.py
+5
-2
No files found.
lib/python/App/tests/test_version_txt.py
View file @
c437f050
...
...
@@ -31,6 +31,7 @@ class VersionTextTestCase(unittest.TestCase):
def
_resetModuleGlobals
(
self
):
from
App
import
version_txt
version_txt
.
_filename
=
'version.txt'
version_txt
.
_version_file
=
None
version_txt
.
_version_string
=
None
version_txt
.
_zope_version
=
None
...
...
@@ -45,7 +46,9 @@ class VersionTextTestCase(unittest.TestCase):
os
.
close
(
f
)
def
test_without_version_txt
(
self
):
from
App
import
version_txt
from
App.version_txt
import
getZopeVersion
version_txt
.
_filename
=
''
self
.
assertEqual
(
getZopeVersion
(),
(
-
1
,
-
1
,
-
1
,
''
,
-
1
))
def
test_with_version_txt_final
(
self
):
...
...
lib/python/App/version_txt.py
View file @
c437f050
...
...
@@ -17,16 +17,19 @@ $id$
import
os
import
re
import
sys
import
Zope2
_location
=
os
.
path
.
dirname
(
Zope2
.
__file__
)
_filename
=
'version.txt'
_version_file
=
None
_version_string
=
None
_zope_version
=
None
def
_get_filename
():
import
Zope2
if
_version_file
is
not
None
:
return
_version_file
return
os
.
path
.
join
(
os
.
path
.
dirname
(
Zope2
.
__file__
),
'version.txt'
)
return
os
.
path
.
join
(
_location
,
_filename
)
def
_prep_version_data
():
global
_version_string
,
_zope_version
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment