Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

"import magic" should be tested more thoroughly #260

Closed
badzil opened this Issue · 5 comments

3 participants

@badzil
Collaborator

Originally on 2010-08-26

In [[source:modules/websubmit/lib/bibdocfile.py#L66|bibdocfile]], [[source:modules/elmsubmit/lib/elmsubmit_filename_generator.py#L33|elmsubmit_filename_generator]] and [[source:configure-tests.py#L240|configure-tests]], we test the import of the module magic. These tests are not sufficient as other Python modules are named magic but do not offer all the variables or functions needed in the code.

So we also need to test that all variables and functions used are present in the imported module, e.g.:

try:
    import magic
    if not hasattr(magic, 'open'):
        raise ImportError
    CFG_HAS_MAGIC = True
except ImportError:
    CFG_HAS_MAGIC = False
@badzil badzil self-assigned this
@badzil
Collaborator

Originally on 2010-08-26

Commit 9208ef210a77c93c1b432321940aecae59454194 fixes the issue.

Ideally Invenio should also support the package being the 1st hit on Google when searching for "python-magic": [http://pypi.python.org/pypi/python-magic/0.1]

@invenio-developers
Collaborator

Originally by Benoit Thiell bthiell@cfa.harvard.edu on 2010-08-26

In [b68827c]:

#CommitTicketReference repository="" revision="b68827cf1aa6a1dbfb1613ad14ea87f6de012a00"
kwalitee: better check of python-magic import

- Check that the python-magic package is the one supported by Invenio.
  (closes #260)
@tiborsimko
Owner

Originally on 2010-08-26

Committed, thanks.

WRT commit log messages, please don't forget to add things like
closes #260 or addresses #260 so that the auto-closure works, see
[[https://twiki.cern.ch/twiki/bin/view/CDS/GitWorkflow#R1_Remarks_on_Git_log_messages]].
(Otherwise I'm adding them, but it is nicer/quicker if you do.)

WRT personal branch names, they may occasionally appear in the repo
history, if things are merged and not cherry-picked. So, generally
speaking, please use something more descriptive than the sole Trac
ticket number. This will make the repo to be nicely usable in the
offline mode: one does not always have online access to Trac, and the
ticket number appears in the commit log message anyway.

@invenio-developers
Collaborator

Originally by Benoit Thiell bthiell@cfa.harvard.edu on 2010-08-27

In [6b1b689]:

#CommitTicketReference repository="" revision="6b1b68977673b9a65f4eacfd21cd2adb7ad9680c"
kwalitee: close mkstemp temporary files

- Properly close temporary files open by tempfile.mkstemp.  (closes #260)
@tiborsimko
Owner

Originally on 2010-08-27

Replying to [comment:5 Benoit Thiell ]:

  • Properly close temporary files open by tempfile.mkstemp. (closes #260)

Wrong ticket number, should have been #262. (spotted after merge)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.