{"action":"closed","issue":{"url":"https://api.github.com/repos/philpep/testinfra/issues/90","repository_url":"https://api.github.com/repos/philpep/testinfra","labels_url":"https://api.github.com/repos/philpep/testinfra/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/philpep/testinfra/issues/90/comments","events_url":"https://api.github.com/repos/philpep/testinfra/issues/90/events","html_url":"https://github.com/philpep/testinfra/issues/90","id":147424442,"number":90,"title":"unable to get version of held packages in DebianPackage","user":{"login":"georgealton","id":1202151,"avatar_url":"https://avatars.githubusercontent.com/u/1202151?v=3","gravatar_id":"","url":"https://api.github.com/users/georgealton","html_url":"https://github.com/georgealton","followers_url":"https://api.github.com/users/georgealton/followers","following_url":"https://api.github.com/users/georgealton/following{/other_user}","gists_url":"https://api.github.com/users/georgealton/gists{/gist_id}","starred_url":"https://api.github.com/users/georgealton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgealton/subscriptions","organizations_url":"https://api.github.com/users/georgealton/orgs","repos_url":"https://api.github.com/users/georgealton/repos","events_url":"https://api.github.com/users/georgealton/events{/privacy}","received_events_url":"https://api.github.com/users/georgealton/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/philpep/testinfra/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-11T13:18:41Z","updated_at":"2016-04-26T19:17:58Z","closed_at":"2016-04-26T19:17:58Z","body":"seems the regex running on the dpkg query when looking for the version fails when a package is held -  seems like it should be using the same regex as the check for installed.\r\n\r\neg I have a test that looks like\r\n\r\n```python\r\ndef test_jetty9_installed(Package):\r\n    jetty9 = Package('jetty9')\r\n    assert jetty9.is_installed\r\n    assert jetty9.version == '9.3.3-1'\r\n```\r\n\r\nhowever the assertion fails ;\r\n\r\n```\r\n   Package = <class 'testinfra.modules.base.DebianPackage'>\r\n\r\n    def test_jetty9_installed(Package):\r\n        jetty9 = Package('jetty9')\r\n        assert jetty9.is_installed\r\n>       assert jetty9.version == '9.3.3-1'\r\nE       assert '' == '9.3.3-1'\r\nE         + 9.3.3-1\r\n\r\ntest.py:98: AssertionError\r\n```\r\n\r\nhere is the output from dpkg\r\n\r\n```\r\nvagrant@medx-dev:~$ dpkg-query -s jetty9\r\nPackage: jetty9\r\nStatus: hold ok installed\r\nPriority: optional\r\nSection: java\r\nInstalled-Size: 11726\r\nMaintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>\r\nArchitecture: all\r\nVersion: 9.3.3-1\r\nDepends: libjetty9-java (>= 9.3.3-1), adduser, apache2-utils, default-jre-headless |                                                                                                                                java5-runtime-headless | java6-runtime-headless\r\nSuggests: libjetty9-extra-java (>= 9.3.3-1), libjetty9-java-doc (>= 9.3.3-1)\r\n```"}}