Skip to content
Snippets Groups Projects
Commit 1fbe6b49 authored by Pierre Lalet's avatar Pierre Lalet Committed by GitHub
Browse files

Merge pull request #837 from guedou/coverage_version

[coverage] Scapy version
parents 535f0689 8a59bf40
No related branches found
No related tags found
No related merge requests found
...@@ -80,9 +80,9 @@ def _version(): ...@@ -80,9 +80,9 @@ def _version():
sha1 = git_archive_id.strip().split()[0] sha1 = git_archive_id.strip().split()[0]
match = re.search(r'tag:(\S+)', git_archive_id) match = re.search(r'tag:(\S+)', git_archive_id)
if match: if match:
return match.group(1) return "git-archive.dev" + match.group(1)
elif sha1: elif sha1:
return sha1 return "git-archive.dev" + sha1
else: else:
return 'unknown.version' return 'unknown.version'
......
...@@ -9146,3 +9146,22 @@ if test_pyx(): ...@@ -9146,3 +9146,22 @@ if test_pyx():
plist.pdfdump(filename) plist.pdfdump(filename)
assert(os.path.exists(filename)) assert(os.path.exists(filename))
os.unlink(filename) os.unlink(filename)
############
############
+ Scapy version
= _version()
import os
version_filename = os.path.join(scapy._SCAPY_PKG_DIR, "VERSION")
version = scapy._version()
assert(os.path.exists(version_filename))
import mock
with mock.patch("scapy._version_from_git_describe") as version_mocked:
version_mocked.side_effect = Exception()
assert(scapy._version() == version)
os.unlink(version_filename)
assert(scapy._version() == "git-archive.dev$Format:%h")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment