Commit Graph

109 Commits

Author SHA1 Message Date
Daniel A. Wozniak
46fa2c04de
Fix py3 os.linesep wart 2018-04-14 17:09:50 -07:00
Daniel A. Wozniak
3c565d7e54
Use salt.utils.fopen 2018-04-13 13:14:19 -07:00
Daniel A. Wozniak
aa965310f1
Clean up cruft 2018-04-13 10:27:17 -07:00
Daniel A Wozniak
efc9866580
Jinja test fixes 2018-04-13 10:23:34 -07:00
Erik Johnson
e2c4702e0c
Update tests to reflect changes to the SaltCacheLoader 2018-02-21 23:20:02 -06:00
Benjamin Drung
b6181b5ed6 Fix Unicode tests when run with LC_ALL=POSIX
When running the unit tests with the locale set to POSIX, some Unicode
tests fail:

$ LC_ALL=POSIX python3 ./tests/runtests.py --unit
[...]
======================================================================
ERROR: test_list_products (unit.modules.test_zypper.ZypperTestCase)
[CPU:0.0%|MEM:73.2%]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/unit/modules/test_zypper.py", line 236, in
test_list_products
    'stdout': get_test_data(filename)
  File "tests/unit/modules/test_zypper.py", line 53, in get_test_data
    return rfh.read()
  File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
828: ordinal not in range(128)

======================================================================
ERROR: test_non_ascii (unit.templates.test_jinja.TestGetTemplate)
[CPU:0.0%|MEM:73.2%]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/unit/templates/test_jinja.py", line 341, in test_non_ascii
    result = fp.read()
  File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5:
ordinal not in range(128)

======================================================================
ERROR: test_non_ascii_encoding
(unit.templates.test_jinja.TestGetTemplate)
[CPU:0.0%|MEM:73.2%]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/unit/templates/test_jinja.py", line 303, in
test_non_ascii_encoding
    fp_.read(),
  File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5:
ordinal not in range(128)
----------------------------------------------------------------------

Therefore open files in binary mode and explicitly decode them with
utf-8 instead of their default locale.
2018-02-01 19:24:23 +01:00
Daniel Wallace
808e26e69a
test simple website 2018-01-20 09:57:20 -07:00
Erik Johnson
958e1aeb8d
Fix test to reflect changes in YAML dumper
PR #42064 modified the YAML dumper to display unicode text as a unicode
literal rather than with the !!python/unicode extension prefix. This
updates the test to reflect the change in Salt's behavior.
2017-11-14 13:43:39 -06:00
twangboy
a4e2d8059d
Fix unit.templates.test_jinja for Windows
Fix problem with files that end with new line on Windows
Fix some problems with regex
Fix some unicode conversion issues
2017-10-16 10:41:36 -06:00
rallytime
998834fbac Sort lists before compairing them in python 3 unit test 2017-08-07 16:09:43 -04:00
rallytime
2be4865f48 [PY3] Fix test that is flaky in Python 3
We can't rely on lists having the same order in Python3 the same
way we rely on them in Python2. If we sort them first, and then
compare them, this test will be more reliable.
2017-07-07 09:43:52 -06:00
Mike Place
5bc7a20327 Missing colon 2017-06-19 10:52:45 -06:00
Mike Place
445f603568 Fix incorrect indentation 2017-06-19 09:37:00 -06:00
Daniel Wallace
4bf030ff65 don't break py2 2017-06-16 13:11:51 -06:00
Daniel Wallace
b65edc786c handle unordered sets in unique jinja tests 2017-06-16 08:40:40 -06:00
rallytime
738681c20f Pylint fix 2017-05-11 09:03:10 -06:00
rallytime
6729587d54 Spelling fix 2017-05-10 16:59:39 -06:00
rallytime
3a5419ba3f Split up test asserts in jinja template unit test
Due to a bug in the equality handler, this test was failing on
CentOS 6 running Python 2.7.13. This PR splits up the test assertions
into several different pieces in order to cover all the possible
use cases, but also pass on CentOS 6.
2017-05-10 16:55:37 -06:00
Pedro Algarvio
9a11538b54
Stop using deprecated TestCase methods 2017-04-01 14:22:57 +01:00
Pedro Algarvio
82eea9057a
Proper mocking 2017-04-01 14:22:56 +01:00
Pedro Algarvio
1f7a0aa65b
Proper mocking 2017-03-28 19:00:51 +01:00
Pedro Algarvio
b25b26e23d
Cleanup test attributes once finished 2017-03-28 19:00:51 +01:00
Pedro Algarvio
40a64191a1
Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
Pedro Algarvio
3beb3fb801
Move whatever we need from salttesting to salt.
Let's drop the salttesting dependency cycle.
2017-02-28 22:52:49 +00:00
Pedro Algarvio
15af4c9728
Test filenames conformity. Adjust for pytest. 2017-02-23 23:19:42 +00:00
Pedro Algarvio
9b2d79317a
Handle different test outcome under Py3 2017-02-17 20:48:55 +00:00
Nicole Thomas
63c7c79455 Fix the new jinja_test failures (#39262)
Refs #37808

The max fuction returns an int, not a float, as does the min function.
This updates the assertions to compare against ints.
2017-02-09 08:53:00 -07:00
Mircea Ulinic
1b397e1b21 Lindt 2017-01-25 16:32:09 +00:00
Mircea Ulinic
9be7de2d4c regex_match filter and tests 2017-01-18 15:01:05 +00:00
Mircea Ulinic
a345e39c5a Test Jinja filters 2017-01-18 15:01:05 +00:00
rallytime
342a5ac0b8 Merge branch '2016.11' into 'develop'
No conflicts.
2017-01-06 10:31:51 -05:00
rallytime
30f14d15df Merge branch '2016.3' into '2016.11'
Conflicts:
  - salt/config/__init__.py
  - salt/engines/slack.py
2017-01-04 16:54:58 -05:00
Jonathan Ballet
2e7f743371 yaml: support unicode serialization/deserialization
Fix: #30454
2017-01-04 13:29:28 +01:00
Jonathan Ballet
df76113c5c jinja: test the "yaml" filter with ordered dicts 2017-01-04 13:29:28 +01:00
Loren Gordon
20eb0bf347 Adds a set theory jinja filter unique 2016-11-04 10:14:24 -04:00
Loren Gordon
f1beaa0ef4 Adds a jinja filter regex_escape
Fixes #37429
2016-11-04 09:54:54 -04:00
rallytime
112903ad7e Merge branch '2016.3' into 'carbon'
Conflicts:
  - conf/master
  - doc/ref/configuration/master.rst
  - salt/cli/daemons.py
  - salt/client/ssh/__init__.py
  - salt/config/__init__.py
  - salt/modules/archive.py
  - salt/modules/cmdmod.py
  - tests/unit/states/service_test.py
2016-09-29 09:56:43 -06:00
Jonathan Ballet
79fdc12395 jinja: fix YAML terminator removal in Jinja's "yaml" filter 2016-09-27 18:52:49 +02:00
rallytime
1fe0b69a6c Merge branch '2016.3' into 'develop'
Conflicts:
  - salt/modules/blockdev.py
  - salt/modules/ddns.py
  - salt/modules/inspectlib/collector.py
  - salt/modules/linux_sysctl.py
  - salt/modules/status.py
  - salt/modules/x509.py
  - salt/utils/process.py
  - salt/utils/verify.py
  - tests/integration/__init__.py
  - tests/integration/modules/state.py
  - tests/integration/states/cmd.py
2016-08-12 16:21:58 -06:00
Erik Johnson
a375dd7e1f Clean up open filehandles (#35359)
* salt/crypt.py: clean up open filehandles

* salt/fileclient.py: clean up open filehandles

* salt/grains/core.py: clean up open filehandles

* salt/modules/cp.py: clean up open filehandles

* salt/modules/data.py: clean up open filehandles

* salt/modules/dnsutil.py: clean up open filehandles

* salt/modules/dockerng.py: clean up open filehandles

* salt/modules/inspectlib/collector.py: clean up open filehandles

* salt/modules/file.py: clean up open filehandles

* salt/modules/hosts.py: clean up open filehandles

* salt/modules/incron.py: clean up open filehandles

* salt/modules/dpkg.py: clean up open filehandles

* salt/modules/linux_sysctl.py: clean up open filehandles

* salt/modules/netbsd_sysctl.py: clean up open filehandles

* salt/modules/network.py: clean up open filehandles

* salt/modules/nftables.py: clean up open filehandles

* salt/modules/openbsd_sysctl.py: clean up open filehandles

* salt/modules/rh_ip.py: clean up open filehandles

* salt/modules/portage_config.py: clean up open filehandles

* salt/modules/status.py: clean up open filehandles

* salt/modules/tls.py: clean up open filehandles

* salt/modules/xapi.py: clean up open filehandles

* salt/modules/x509.py: clean up open filehandles

* salt/modules/virt.py: clean up open filehandles

* salt/modules/zcbuildout.py: clean up open filehandles

* salt/returners/local_cache.py: clean up open filehandles

* salt/utils/cloud.py: clean up open filehandles

* salt/states/pkgrepo.py: clean up open filehandles

* salt/states/x509.py: clean up open filehandles

* salt/transport/mixins/auth.py: clean up open filehandles

* salt/utils/__init__.py: clean up open filehandles

* salt/states/pkg.py: clean up open filehandles

* salt/utils/minion.py: clean up open filehandles

* salt/utils/openstack/nova.py: clean up open filehandles

* salt/utils/openstack/swift.py: clean up open filehandles

* salt/utils/process.py: clean up open filehandles

* salt/utils/templates.py: clean up open filehandles

* salt/utils/virt.py: clean up open filehandles

* tests/integration/__init__.py: clean up open filehandles

* tests/integration/cli/grains.py: clean up open filehandles

* tests/integration/client/standard.py: clean up open filehandles

* tests/integration/modules/hosts.py: clean up open filehandles

* tests/unit/utils/vt_test.py: clean up open filehandles

* tests/integration/shell/enabled.py: clean up open filehandles

* tests/integration/states/cmd.py: clean up open filehandles

* tests/integration/states/file.py: clean up open filehandles

* tests/integration/states/match.py: clean up open filehandles

* tests/unit/config_test.py: clean up open filehandles

* tests/unit/templates/jinja_test.py: clean up open filehandles

* tests/unit/utils/find_test.py: clean up open filehandles

* tests/integration/modules/state.py: clean up open filehandles

* Update dnsutil_test to reflect changes in fopen usage
2016-08-11 10:45:24 -06:00
rallytime
c7c9e3b64b PY3: Fixup jinja template unit tests 2016-08-03 12:45:29 -06:00
Mike Place
b3b1536afd Derp 2015-06-10 15:50:53 -06:00
Mike Place
7e153bc6a9 Fix unit test warnings 2015-06-10 15:37:01 -06:00
Michael Steed
f9cf15ad46 fix new failures on ubuntu 14.04 2015-06-09 14:18:04 -06:00
Michael Steed
8669dacaf1 likewise in test_render_with_utf8_syntax_error() 2015-06-09 11:48:13 -06:00
Michael Steed
4b34b60623 set encoding in test_render_with_unicode_syntax_error() 2015-06-09 11:43:23 -06:00
Pedro Algarvio
60f215f191 Add from __future__ import absolute_import 2015-01-30 22:25:04 +00:00
Erik Johnson
59e7481e2b Fix TestSaltCacheLoader tests
Similar fixes as made for TestGetTemplate
2015-01-26 16:04:21 -06:00
Erik Johnson
d34c0c7787 Fix jinja tests
With recent edits to the jinja templating system, file_roots and
pillar_roots are referenced, so they need to be in the mocked opts dict.
2015-01-26 13:10:05 -06:00
Erik Johnson
c1fd180c45 Fix jinja tests
These tests were using the now-outdated method of looking in the
file_roots for cached templates in masterless mode.
2014-12-10 18:41:32 -06:00