Giter VIP home page Giter VIP logo

Comments (22)

sbraz avatar sbraz commented on June 5, 2024

Tests require pytest and pytest-runner:

tests_require=["pytest", "pytest-runner"],

Other than that, yes, you can run them this way.

from pymediainfo.

Vascom avatar Vascom commented on June 5, 2024

May be not close issue so fast? :)

Now tests are running but failure

running pytest
running egg_info
writing pymediainfo.egg-info/PKG-INFO
writing namespace_packages to pymediainfo.egg-info/namespace_packages.txt
writing top-level names to pymediainfo.egg-info/top_level.txt
writing dependency_links to pymediainfo.egg-info/dependency_links.txt
reading manifest file 'pymediainfo.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '.*'
'tests/data/accentué.txt' not ANSI_X3.4-1968 encodable -- skipping
warning: no previously-included files matching '__pycache__' found anywhere in distribution
warning: no previously-included files matching '*.py[co]' found anywhere in distribution
writing manifest file 'pymediainfo.egg-info/SOURCES.txt'
running build_ext
============================================================= test session starts ==============================================================
platform linux2 -- Python 2.7.14, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/vascom/rpmbuild/BUILD/python-pymediainfo-2.2.0/python2, inifile:
collected 15 items                                                                                                                              

tests/test_pymediainfo.py ............F.s

=================================================================== FAILURES ===================================================================
_____________________________________________ MediaInfoUnicodeFileNameTest.test_parse_unicode_file _____________________________________________

self = <test_pymediainfo.MediaInfoUnicodeFileNameTest testMethod=test_parse_unicode_file>

    def test_parse_unicode_file(self):
>       self.assertEqual(len(self.mi.tracks), 1)
E       AssertionError: 0 != 1

tests/test_pymediainfo.py:83: AssertionError
================================================ 1 failed, 13 passed, 1 skipped in 3.15 seconds ================================================

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

Hehe yeah, my bad :) Can you check that you're using an UTF-8 locale?

from pymediainfo.

Vascom avatar Vascom commented on June 5, 2024
$ locale
LANG=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=

With LANG=C I have the same error.

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

Does the test system use the same locales? Can you try running python2 demo.py tests/data/accentué.txt manually and see if it works?
It should yield:

+---------+
| General |
+---------+
{'complete_name': u'tests/data/accentu\xe9.txt',
 'count': '328',
 'count_of_stream_of_this_kind': '1',
 'file_extension': 'txt',
 'file_last_modification_date': 'UTC 2016-04-30 21:05:40',
 'file_last_modification_date__local': '2016-04-30 23:05:40',
 'file_name': u'accentu\xe9',
 'file_size': 20,
 'folder_name': 'tests/data',
 'kind_of_stream': 'General',
 'other_file_size': ['20.0 Bytes',
                     '20 Bytes',
                     '20 Bytes',
                     '20.0 Bytes',
                     '20.00 Bytes'],
 'other_kind_of_stream': ['General'],
 'other_stream_size': ['20.0 Bytes (100%)',
                       '20 Bytes',
                       '20 Bytes',
                       '20.0 Bytes',
                       '20.00 Bytes',
                       '20.0 Bytes (100%)'],
 'proportion_of_this_stream': '1.00000',
 'stream_identifier': '0',
 'stream_size': 20,
 'track_type': 'General'}

from pymediainfo.

Vascom avatar Vascom commented on June 5, 2024

Locale the same. I am built and run it on my local computer.
Yes, it work

+---------+
| General |
+---------+
{'complete_name': u'tests/data/accentu\xe9.txt',
 'count': '328',
 'count_of_stream_of_this_kind': '1',
 'file_extension': 'txt',
 'file_last_modification_date': 'UTC 2017-11-07 23:04:01',
 'file_last_modification_date__local': '2017-11-08 02:04:01',
 'file_name': u'accentu\xe9',
 'file_size': 20,
 'folder_name': 'tests/data',
 'kind_of_stream': 'General',
 'other_file_size': ['20.0 Bytes',
                     '20 Bytes',
                     '20 Bytes',
                     '20.0 Bytes',
                     '20.00 Bytes'],
 'other_kind_of_stream': ['General'],
 'other_stream_size': ['20.0 Bytes (100%)',
                       '20 Bytes',
                       '20 Bytes',
                       '20.0 Bytes',
                       '20.00 Bytes',
                       '20.0 Bytes (100%)'],
 'proportion_of_this_stream': '1.00000',
 'stream_identifier': '0',
 'stream_size': 20,
 'track_type': 'General'}

from pymediainfo.

Vascom avatar Vascom commented on June 5, 2024

May be it is because
'tests/data/accentué.txt' not ANSI_X3.4-1968 encodable -- skipping

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

And if you run the tests manually, I assume it works too? This must be a problem with the RPM build system changing locales.

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

The RPM system re-creates the source tarball?

from pymediainfo.

Vascom avatar Vascom commented on June 5, 2024

Hm, if I run tests manually, not from rpmbuild - all passed. And there is no skipping warning.

from pymediainfo.

Vascom avatar Vascom commented on June 5, 2024

No, source tarball not reacreated.

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

Do you know what command produces the ANSI_X3.4-1968 error? Is it a setup.py command?

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

From what I understand, it could be due to an old setuptools version.

from pymediainfo.

Vascom avatar Vascom commented on June 5, 2024

In rpmbuild this locale:

 LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=

And with LANG=C test failed manually.

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

OK so I guess you just have to change the rpmbuild locale, if possible. Or skip this particular test.

from pymediainfo.

Vascom avatar Vascom commented on June 5, 2024

Are you sure that this is not problem in test? Because LANG=C is most default problemless variant of locale.

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

I never was able to parse an accentuated file without an UTF-8 locale: MediaArea/MediaInfoLib#144
if this is a bug, it's a MediaInfo bug: try running mediainfo tests/data/accentué.txt with LANG=C and it will fail too.

from pymediainfo.

Vascom avatar Vascom commented on June 5, 2024

OK. How to skip this particular test?

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

Instead of running setup.py test, you can run pytest -k "not test_parse_unicode_file".

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

And if you run pytest directly, you do not need pytest-runner, this one is only for setup.py support.

from pymediainfo.

Vascom avatar Vascom commented on June 5, 2024

Thanks. I will use
PYTEST_ADDOPTS='-k "not test_parse_unicode_file"' %{__python2} setup.py test

from pymediainfo.

sbraz avatar sbraz commented on June 5, 2024

Cool! Thanks for adding this to Fedora!

from pymediainfo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.