
    -Ph                         d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ d	d
lmZ d	dlmZ ddlmZmZmZmZmZ  G d de          ZdS )    N)date)Path)call)dedent)patch)	CliRunner)TestCase   )cli)_main   )readread_pkg_resourcewith_git_projectwith_projectwritec                   .   e Zd ZdZ e            d             Zd Zd Z e            d             Z e            d             Z	 e            d             Z
 ed	          d
             Z e            d             Z e            d             Z e            d             Z e            d             Zd Z e            d             Z e            d             Z e            d             Z e            d             Z e            d             Zd Z ed	          defd            Z e            d             Z ed	          d             Z ed	          d             Z ed	          d             Z ed	          d              Z ed!	          d"             Zd# Z  ed$	          d%             Z! ed&	          d'             Z" ed(	          d)             Z# ed*	          d+             Z$ ed,	          d-             Z% ed.	          d/             Z& e            d0             Z' ed1	          d2             Z( ed3	          d4             Z) ed5	          d6             Z* ed7	          d8             Z+ ed9	          d:             Z, e            d;             Z- ed<	          d=             Z. ed>	          d?             Z/ ed@	          dA             Z0 e            dB             Z1dS )CTestCliNc                    t          dd          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d	           d d d            n# 1 swxY w Y   t          d
d          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d           d d d            n# 1 swxY w Y   |                    |g d          }|                     d|j        |j                   |                     |j        t          d                     d S )Nfoo/newsfragments/123.featurewAdds levitation!foo/newsfragments/124.feature.rstExtends levitationz!foo/newsfragments/baz.feature.rstzBaz levitationz!foo/newsfragments/fix-1.2.featurezBaz fix levitationz#foo/newsfragments/+anything.featurezOrphaned featurezfoo/newsfragments/+xxx.featurezAnother orphaned featurez'foo/newsfragments/+123_orphaned.featurez*An orphaned feature starting with a numberz(foo/newsfragments/+12.3_orphaned.featurez1An orphaned feature starting with a dotted numberz'foo/newsfragments/+orphaned_123.featurez(An orphaned feature ending with a numberz(foo/newsfragments/+orphaned_12.3.featurez/An orphaned feature ending with a dotted numberzfoo/newsfragments/READMEz	Blah blahzfoo/newsfragments/README.rstz**Blah blah**--draft--date
01-01-2001r   a|                  Loading template...
                Finding news fragments...
                Rendering news fragments...
                Draft only -- nothing has been written.
                What is seen below is what would be written.

                Foo 1.2.3 (01-01-2001)
                ======================

                Features
                --------

                - Baz levitation (baz)
                - Baz fix levitation (fix-1.2)
                - Adds levitation (#123)
                - Extends levitation (#124)
                - An orphaned feature ending with a dotted number
                - An orphaned feature ending with a number
                - An orphaned feature starting with a dotted number
                - An orphaned feature starting with a number
                - Another orphaned feature
                - Orphaned feature



                )openr   invokeassertEqual	exit_codeoutputr   )selfcommandrunnerfresults        Y/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/towncrier/test/test_build.py_test_commandzTestCli._test_command   sH    1377 	'1GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 5s;; 	*qGG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 5s;; 	&qGG$%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 5s;; 	*qGG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 7== 	(GG&'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(2C88 	0AGG.///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0;SAA 	BQGG@AAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B<cBB 	IaGGGHHH	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I;SAA 	@QGG>???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@<cBB 	GaGGEFFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G ,c22 	!aGGK   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 0#66 	%!GGO$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% w(K(K(KLLF,fm<<<M 	
 	
 	
 	
 	
s   377A00A47A4B--B14B1C**C.1C.D''D+.D+E$$E(+E(?F!!F%(F%<GG"%G"9HH"H6III3JJJ0KKKc                 :    |                      t                     d S N)r*   r   r$   s    r)   test_commandzTestCli.test_command_   s    3    c                 :    |                      t                     d S r,   )r*   r   r-   s    r)   test_subcommandzTestCli.test_subcommandb   s    5!!!!!r/   c                    t          d                                          }t          d                              d           |                     |dz                                             t          j                    }|                     |j                   t          j
        |j                   |                    t          ddt          |          f          }|                     g t!          t          |j                                      d                               |                     d|j                   |                     |dz                                             d	S )
zj
        The current working directory doesn't matter as long as we pass
        the correct one.
        .r   r   NEWS.rst--yes--dir*r   N)r   resolve
write_textassertFalseexiststempfileTemporaryDirectory
addCleanupcleanuposchdirnamer    r   strr!   listglobr"   
assertTruer$   r&   project_dirtdr(   s        r)    test_in_different_dir_dir_optionz(TestCli.test_in_different_dir_dir_optione   s,    3ii'')),--889JKKK+
2::<<=== (**
###
sWgs;7G7G$HIIT$rw--"4"4S"9"9::;;;F,---z199;;<<<<<r/   c                     t          j        d           |                    t          g d          }|                     d|j        |j                   dS )z
        When the current directory doesn't contain the configuration file, Towncrier
        will traverse up the directory tree until it finds it.
        foor   r   N)r@   rA   r    r   r!   r"   r#   r$   r&   r(   s      r)   test_traverse_up_to_find_configz'TestCli.test_traverse_up_to_find_config}   sN     	u&I&I&IJJF,fm<<<<<r/   c           
      <   t          d                                          }t          d                              d           |                     |dz                                             t          j                    }|                     |j                   t          j
        |j                   |dz                      d           |                    t          ddddt          |          f          }|                     t          |j                  dz  gt#          t          |j                                      d	                               |                     d
|j                   |                     |dz                                             dS )z
        The current working directory and the location of the configuration
        don't matter as long as we pass correct paths to the directory and the
        config file.
        r3   r   r   r4   pyproject.tomlr5   --configr6   r7   r   N)r   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   renamer    r   rC   r!   rD   rE   r"   rF   rG   s        r)   #test_in_different_dir_config_optionz+TestCli.test_in_different_dir_config_option   sm    3ii'')),--889JKKK+
2::<<=== (**
###
	'	'//0@AAA':'7#kBRBRS
 

 	"']]--.T"']]5G5G5L5L0M0M	
 	
 	
 	F,---z199;;<<<<<r/   zD
        [tool.towncrier]
        directory = "changelog.d"
        )configc                 R   t          d                              d           t          d                              d           t          d                                           t          d                              d           |                     t          d	                                                     |                    t          d
          }|                     d|j                   | 	                    t          d	                                                     dS )z
        Using the `--dir` CLI argument, the NEWS file can
        be generated in a sub-directory from fragments
        that are relatives to that sub-directory.

        The path passed to `--dir` becomes the
        working directory.
        zfoo/fooT)parentszfoo/foo/__init__.py zfoo/changelog.dzfoo/changelog.d/123.featurer   zfoo/NEWS.rst)r5   rQ   rP   r6   rL   	--versionz1.0r   N)
r   mkdirr9   r:   r;   r    r   r!   r"   rF   rM   s      r)   =test_in_different_dir_with_nondefault_newsfragments_directoryzETestCli.test_in_different_dir_with_nondefault_newsfragments_directory   s     	Yd+++"##..r222%%'''*++667HIIIn--4466777W
 

 	F,---^,,335566666r/   c                     t          j        d           |                    t          g d          }|                     d|j                   |                     d|j                   dS )zS
        A missing newsfragment directory acts as if there are no changes.
        zfoo/newsfragmentsr   r   No significant changes.
N)r@   rmdirr    r   r!   r"   assertInr#   rM   s      r)   test_no_newsfragment_directoryz&TestCli.test_no_newsfragment_directory   se    
 	$%%%u&I&I&IJJF,---16=AAAAAr/   c                     |                     t          g d          }|                     d|j                   |                     d|j                   dS )zR
        An empty newsfragment directory acts as if there are no changes.
        r   r   r\   Nr    r   r!   r"   r^   r#   rM   s      r)   test_no_newsfragments_draftz#TestCli.test_no_newsfragments_draft   sT    
 u&I&I&IJJF,---16=AAAAAr/   c                     |                     t          ddg          }t          d          }|                     d|j                   |                     d|           dS )z
        An empty newsfragment directory acts as if there are no changes and
        removing files handles it gracefully.
        r   r   r4   r   r\   N)r    r   r   r!   r"   r^   )r$   r&   r(   newss       r)   test_no_newsfragmentszTestCli.test_no_newsfragments   s]     ux&>??JF,---1488888r/   c                    t          dd          5 }|                    d           d d d            n# 1 swxY w Y   t          dd          5 }|                    d           d d d            n# 1 swxY w Y   |                    t          g d          }|                     t          |j                  t                     |                     dt          |j                             d S )Nr   r   r   z!foo/newsfragments/123.feature.rstr   r   zmultiple files for 123.feature)
r   r   r    r   r!   type	exception
ValueErrorr^   rC   r$   r&   r'   r(   s       r)   test_collisionzTestCli.test_collision   sU    1377 	'1GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'5s;; 	*qGG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* u&I&I&IJJ 	f.//<<<6F<L8M8MNNNNN   377A00A47A4c                    t                      fd} |ddgddg          }|                     d|j                   |                     |j        dt	          d          z               |ddgddg          }|                     d|j                   |                     |j        dt	          d	          z              d
S )zx
        Sections and types should be output in the same order that they're
        defined in the config file.
        c           
                                          5  t          dd          5 }|                    t          d                     | D ]8}|                    t          d                    |                               9|D ]8}|                    t          d                    |                               9	 d d d            n# 1 swxY w Y   t          j        d           t          d	d          5 }|                    d
           d d d            n# 1 swxY w Y   t          j        d           | D ]g}d|z   }t          j        |           |D ]I}t          | d| d          5 }|                    | d|            d d d            n# 1 swxY w Y   Jh                    t          g dd          cd d d            S # 1 swxY w Y   d S )NrP   r   z
                    [tool.towncrier]
                        package = "foo"
                        directory = "news"

                    z
                        [[tool.towncrier.section]]
                            path = "{section}"
                            name = "{section}"
                        )sectionz
                        [[tool.towncrier.type]]
                            directory = "{type_}"
                            name = "{type_}"
                            showcontent = true
                        )type_rL   foo/__init__.pyz__version__ = "1.2.3"
rd   znews/z/1. r   Fcatch_exceptions)	isolated_filesystemr   r   r   formatr@   rY   r    r   )sectionstypesr'   ro   rp   sectdirr&   s         r)   run_order_scenariozATestCli.test_section_and_type_sorting.<locals>.run_order_scenario   sC   ++-- 5 5*C00 %AGG 	 	 	 $,  "! #F,3 # " " 
 
 
 
 "'  "!
 #F*/ # " "	 	   3% % % % % % % % % % % % % % %N +S11 7QGG56667 7 7 7 7 7 7 7 7 7 7 7 7 7 7   ' : :G%/GHW%%%!& : :!W"8"8"8"8#>> :!GGw$8$8$8$8999: : : : : : : : : : : : : : :: }}>>>QV %  g5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s~   GBCGC	GC	'G<DGD"	"G%D"	&AG3F	GFG!F"#GGGz	section-az	section-bztype-1ztype-2r   zLoading template...
Finding news fragments...
Rendering news fragments...
Draft only -- nothing has been written.
What is seen below is what would be written.

Foo 1.2.3 (01-01-2001)
======================a  
                  section-a
                  ---------

                  type-1
                  ~~~~~~

                  - section-a type-1 (#1)


                  type-2
                  ~~~~~~

                  - section-a type-2 (#1)


                  section-b
                  ---------

                  type-1
                  ~~~~~~

                  - section-b type-1 (#1)


                  type-2
                  ~~~~~~

                  - section-b type-2 (#1)



            a  
                  section-b
                  ---------

                  type-2
                  ~~~~~~

                  - section-b type-2 (#1)


                  type-1
                  ~~~~~~

                  - section-b type-1 (#1)


                  section-a
                  ---------

                  type-2
                  ~~~~~~

                  - section-a type-2 (#1)


                  type-1
                  ~~~~~~

                  - section-a type-1 (#1)



            N)r   r!   r"   r#   r   )r$   rz   r(   r&   s      @r)   test_section_and_type_sortingz%TestCli.test_section_and_type_sorting   s    6	 6	 6	 6	 6	p $#[+$>8@TUUF,---M'  " "	&)	
 )	
 )	
V $#[+$>8@TUUF,---M'  " "	&)	
 )	
 )	
 )	
 )	
r/   c                    d}d}t          |d          5 }|                    d           ddd           n# 1 swxY w Y   t          |d          5 }|                    d           ddd           n# 1 swxY w Y    |             t          j                    }|                    t
          dg          }|                     d|j                   |                     d	|	                                 d
|j
                   dS )z=
        If no date is passed, today's date is used.
        r   r   r   r   Nr   r   r   zFoo 1.2.3 ())r   r   r   todayr    r   r!   r"   r^   	isoformatr#   )r$   r&   commitfragment_path1fragment_path2r'   r~   r(   s           r)   test_draft_no_datezTestCli.test_draft_no_date  sp   
 9<.#&& 	'!GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'.#&& 	*!GG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	
uyk22F,---8EOO$5$5888&-HHHHH   7;;A44A8;A8c                    d}d}t          |d          5 }|                    d           d d d            n# 1 swxY w Y   t          |d          5 }|                    d           d d d            n# 1 swxY w Y    |             |                    t          g d          }|                     d|j                   d}|                     t          j        	                    |                     | 
                    t          j        	                    |                     | 
                    t          j        	                    |                     d S )	Nr   r   r   r   r   r   r   r5   r   r4   )r   r   r    r   r!   r"   rF   r@   pathisfiler:   )r$   r&   r   r   r   r'   r(   r   s           r)   test_no_confirmationzTestCli.test_no_confirmation  s   8<.#&& 	'!GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'.#&& 	*!GG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	u&G&G&GHHF,---t,,---778887788888r   c                    d}d}t          |d          5 }|                    d           ddd           n# 1 swxY w Y   t          |d          5 }|                    d           ddd           n# 1 swxY w Y    |             |                    t          g d          }|                     d|j                   |                     t          j        	                    d	                     |                     t          j        	                    |                     |                     t          j        	                    |                     dS )
z
        The `--keep` option will build the full final news file
        without deleting the fragment files and without
        any extra CLI interaction or confirmation.
        r   r   r   r   Nr   )r   r   --keepr   r4   )
r   r   r    r   r!   r"   rF   r@   r   r   r$   r&   r   r   r   r'   r(   s          r)   test_keep_fragmentszTestCli.test_keep_fragments  s    9<.#&& 	'!GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'.#&& 	*!GG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	u&H&H&HIIF,--- 	z22333~66777~6677777r   c                    d}d}t          |d          5 }|                    d           ddd           n# 1 swxY w Y   t          |d          5 }|                    d           ddd           n# 1 swxY w Y    |             |                    t          g d          }|                     d|j                   |                    t          g d	          }|                     d|j                   dS )
aF  
        It will fail to perform any action when the
        conflicting --keep and --yes options are provided.

        Called twice with the different order of --keep and --yes options
        to make sure both orders are validated since click triggers the validator
        in the order it parses the command line.
        r   r   r   r   Nr   )r   r   r5   r   r   )r   r   r   r5   )r   r   r    r   r!   r"   r   s          r)   test_yes_keep_errorzTestCli.test_yes_keep_error  sq    9<.#&& 	'!GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'.#&& 	*!GG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	u&Q&Q&QRRF,---u&Q&Q&QRRF,-----r   c                    d}d}t          |d          5 }|                    d           ddd           n# 1 swxY w Y   t          |d          5 }|                    d           ddd           n# 1 swxY w Y    |             t          d          5 }d|_        |                    t
          g           }ddd           n# 1 swxY w Y   |                     d	|j                   d
}|                     t          j
                            |                     |                     t          j
                            |                     |                     t          j
                            |                     dS )z
        If the user says "no" to removing the newsfragements, we end up with
        a NEWS.rst AND the newsfragments.
        r   r   r   r   Nr   ztowncrier.build.click.confirmFr   r4   )r   r   r   return_valuer    r   r!   r"   rF   r@   r   r   )	r$   r&   r   r   r   r'   mr(   r   s	            r)   test_confirmation_says_noz!TestCli.test_confirmation_says_no  s    9<.#&& 	'!GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'.#&& 	*!GG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	233 	.q"AN]]5"--F	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	F,---t,,---~66777~6677777s0   7;;A44A8;A8#CCCc                 N   t                      }|                                5  |                    t          dg          }ddd           n# 1 swxY w Y   |                     d|j        |j                   |                     |j                            d                     dS )z7
        Towncrier needs a configuration file.
        r   Nr   zNo configuration file found.)	r   ru   r    r   r!   r"   r#   rF   
startswithrM   s      r)   test_needs_configzTestCli.test_needs_config   s     '')) 	7 	7]]59+66F	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	F,fm<<<001OPPQQQQQs   AAA[tool.towncrier]r&   c                     |                     t          dgd          }|                     d|j                   |                     d|j                   dS )z{
        If the configuration file doesn't specify a version or a package, the version
        option is required.
        r   Frs   r
   zError: '--version' is requiredNra   rM   s      r)   test_needs_versionzTestCli.test_needs_version  sS     uykEJJF,---6FFFFFr/   c                     t          d                                           t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t
          g d          }|                     d	|j                   |                     |j        t          d
          
                                           dS )zIn which a directory containing news files is built into a changelog

        - without a Python project or version number. We override the
        project title from the commandline.
        rq   r   r   r   Nr   r   )--name	FooBarBazrX   7.8.9r   r   r   r   a  
            Loading template...
            Finding news fragments...
            Rendering news fragments...
            Draft only -- nothing has been written.
            What is seen below is what would be written.

            FooBarBaz 7.8.9 (01-01-2001)
            ============================

            Features
            --------

            - Adds levitation (#123)
            - Extends levitation (#124)



            )r   unlinkr   r   r    r   r!   r"   r#   r   lstriprj   s       r)   test_projectless_changelogz"TestCli.test_projectless_changelog  s    	&&(((1377 	'1GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 5s;; 	*qGG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*   
 
 	F,---M ( fhh-	
 	
 	
 	
 	
s#   AAA/BBBz<
        [tool.towncrier]
        version = "7.8.9"
        c                    t          j        d           t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t
          g d          }|                     d|j        |j                   |                     |j        t          d          
                                           dS )	zCalling towncrier with version defined in configfile.

        Specifying a version in toml file will be helpful if version
        is maintained by i.e. bumpversion and it's not a python project.
        newsfragmentsnewsfragments/123.featurer   r   N)r   r   r   r   {  
            Loading template...
            Finding news fragments...
            Rendering news fragments...
            Draft only -- nothing has been written.
            What is seen below is what would be written.

            7.8.9 (01-01-2001)
            ==================

            Features
            --------

            - Adds levitation (#123)



            r@   rY   r   r   r    r   r!   r"   r#   r   r   rj   s       r)   test_version_in_configzTestCli.test_version_in_configN  s    	!!!-s33 	'qGG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' u&I&I&IJJF,fm<<<M & fhh+	
 	
 	
 	
 	
   AAAz?
        [tool.towncrier]
        name = "ImGoProject"
        c                    t          j        d           t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t
          g d          }|                     d|j        |j                   |                     |j        t          d          
                                           dS )	zThe calling towncrier with project name defined in configfile.

        Specifying a project name in toml file will be helpful to keep the
        project name consistent as part of the towncrier configuration, not call.
        r   r   r   r   NrX   r   r   r   r   r   a  
            Loading template...
            Finding news fragments...
            Rendering news fragments...
            Draft only -- nothing has been written.
            What is seen below is what would be written.

            ImGoProject 7.8.9 (01-01-2001)
            ==============================

            Features
            --------

            - Adds levitation (#123)



            r   rj   s       r)   test_project_name_in_configz#TestCli.test_project_name_in_configy  s    	!!!-s33 	'qGG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' LLL
 
 	F,fm<<<M & fhh+	
 	
 	
 	
 	
r   c                    t          j        d           t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t
          g d          }|                     d|j        |j                   |                     |j        t          d          
                                           dS )	aX  The calling towncrier with any package argument.

        Specifying a package in the toml file or the command line
        should not always be needed:
        - we can set the version number on the command line,
          so we do not need the package for that.
        - we don't need to include the package in the changelog header.
        r   r   r   r   Nr   r   r   r   rj   s       r)   test_no_package_changelogz!TestCli.test_no_package_changelog  s    	!!!-s33 	'qGG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' LLL
 
 	F,fm<<<M & fhh+	
 	
 	
 	
 	
r   ze
        [tool.towncrier]
         single_file=false
         filename="{version}-notes.rst"
        c           
         fd}g }t          j        d           |                     |ddd                     |                     |ddd                     |                     d	|d	         j        |d	         j                   |                     d	|d
         j        |d
         j                   |                     dt          t          t          j	                    
                    d                              d           |                     t           j                            d          t          j        d                     |                     t           j                            d          t          j        d                     g }|                    t          d                     |                    t          d                     |                     |d	         t!          d                                                     |                     |d
         t!          d                                                     dS )z
        When `single_file = false` the release notes for each version are stored
        in a separate file.
        The name of the file is defined by the `filename` configuration value.
        c           
         t          d| d          5 }|                    |           d d d            n# 1 swxY w Y                       t          d| dddddg          }t	          d|                                           rJ |S )	Nnewsfragments/r   rX   r   rL   r   r   r5   r   r   r    r   r   r;   versionfragment_filefragmentr'   r(   r&   s        r)   do_build_once_withzHTestCli.test_release_notes_in_separate_files.<locals>.do_build_once_with  s    6}66<< "!!!" " " " " " " " " " " " " " " ]]  F <]<<==DDFFFFFM   7;;r   r   123.featurer   7.9.0
456.bugfixAdds catapultr   r   r
   *-notes.rstzone newfile for each buildz7.8.9-notes.rstr3   z7.9.0-notes.rstz
            foo 7.8.9 (01-01-2001)
            ======================

            Features
            --------

            - Adds levitation (#123)
            z
            foo 7.9.0 (01-01-2001)
            ======================

            Bugfixes
            --------

            - Adds catapult (#456)
            N)r@   rY   appendr!   r"   r#   lenrD   r   cwdrE   rF   r   r;   listdirr   r   r   )r$   r&   r   resultsoutputss    `   r)   $test_release_notes_in_separate_filesz,TestCli.test_release_notes_in_separate_files  s   	 	 	 	 	( 
!!!))'=BSTTUUU))'<QQRRRGAJ0'!*2CDDDGAJ0'!*2CDDDTXZZ__]334455(	
 	
 	

 	'8992:c??KKK'8992:c??KKKt-..///t-..///AJ
 
 fhh	
 	
 	
 	AJ
 
 fhh	
 	
 	
 	
 	
r/   z=
        [tool.towncrier]
        singlefile="fail!"
        c                     |                     t                    }|                     d|j                   |                     d|j                   dS )zt
        Failure to find the configuration file results in a clean explanation
        without a traceback.
        r   z@`singlefile` is not a valid option. Did you mean `single_file`?
N)r    r   r!   r"   r#   rM   s      r)   +test_singlefile_errors_and_explains_cleanlyz3TestCli.test_singlefile_errors_and_explains_cleanly#  sX     u%%F,---OM	
 	
 	
 	
 	
r/   c                 H   t                      fd}g }                                5  t          dd          5 }|                    d                    g d                     ddd           n# 1 swxY w Y   t          j        d           |                     |dd	d
                     |                     |ddd                     |                     d|d         j	        |d         j
                   |                     d|d         j	        |d         j
                   |                     dt          t          t          j                                        d                              d           |                     t
          j                            d          t          j        d                     t)          d          }|                     |t+          d                                                     ddd           dS # 1 swxY w Y   dS )a  
        When `single_file = true` the single file is used to store the notes
        for multiple versions.

        The name of the file is fixed as the literal option `filename` option
        in the configuration file, instead of extrapolated with variables.
        c           
         t          d| d          5 }|                    |           d d d            n# 1 swxY w Y                       t          d| dddddgd	
          }t	          d|                                           rJ |S )Nr   r   rX   r   rL   r   r   r5   Frs   r   r   s        r)   r   zKTestCli.test_all_version_notes_in_a_single_file.<locals>.do_build_once_with@  s    6}66<< "!!!" " " " " " " " " " " " " " " ]]  "' #  F <]<<==DDFFFFFMr   rP   r   
)r   z single_file=truez@ # The `filename` variable is fixed and not formated in any way.z filename="{version}-notes.rst"Nr   r   r   r   r   r   r   r   r   r   z"single newfile for multiple buildsz{version}-notes.rstr3   ag  
                foo 7.9.0 (01-01-2001)
                ======================

                Bugfixes
                --------

                - Adds catapult (#456)


                foo 7.8.9 (01-01-2001)
                ======================

                Features
                --------

                - Adds levitation (#123)
                )r   ru   r   r   joinr@   rY   r   r!   r"   r#   r   rD   r   r   rE   rF   r   r;   r   r   r   r   )r$   r   r   r'   r#   r&   s        @r)   'test_all_version_notes_in_a_single_filez/TestCli.test_all_version_notes_in_a_single_file6  s    	 	 	 	 	* '')) 3	 3	&,, 
II   	 	 	
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 H_%%%NN""7M;LMM   NN--g|_UUVVVQ
 4gaj6GHHHQ
 4gaj6GHHHD7788994  
 OOBGNN+@AA2:c??SSS/00F & &((+  ;3	 3	 3	 3	 3	 3	 3	 3	 3	 3	 3	 3	 3	 3	 3	 3	 3	 3	s5   H+A3'H3A7	7H:A7	;FHHHzp
        [tool.towncrier]
        template="towncrier:single-file-no-bullets"
        all_bullets=false
        c                    t          j        d           t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d	           ddd           n# 1 swxY w Y   t          d
d          5 }|                    d           ddd           n# 1 swxY w Y   |                    t
          g d          }|                     d|j        |j                   t          d          }|                     |t          d                                                     dS )z
        When all_bullets is false, subsequent lines are not indented.

        The automatic issue number inserted by towncrier will align with the
        manual bullet.
        r   r   r   z!wow!
~~~~

No indentation at all.Nznewsfragments/124.bugfixz#. Numbered bullet list.znewsfragments/125.removalz- Hyphen based bullet list.znewsfragments/126.docz* Asterisk based bullet list.rX   r   r   rL   r   r   r5   r   r4   a  
                foo 7.8.9 (01-01-2001)
                ======================

                Features
                --------

                wow!
                ~~~~

                No indentation at all.
                (#123)


                Bugfixes
                --------

                #. Numbered bullet list.
                   (#124)


                Improved Documentation
                ----------------------

                * Asterisk based bullet list.
                  (#126)


                Deprecations and Removals
                -------------------------

                - Hyphen based bullet list.
                  (#125)
                )r@   rY   r   r   r    r   r!   r"   r#   r   r   r   )r$   r&   r'   r(   r#   s        r)   test_bullet_points_falsez TestCli.test_bullet_points_false  s    	!!!-s33 	<qGG:;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<,c22 	0aGG.///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0-s33 	3qGG1222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3)3// 	51GG3444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5   
 
 	F,fm<<<j!!!# #F fhhK&	
 &	
 &	
 &	
 &	
G   AAA"BBBCCCC>>DDz
        [tool.towncrier]
        package = "foo"
        title_format = "[{project_date}] CUSTOM RELEASE for {name} version {version}"
        c                    t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t          g d          }t	          d          }|                     d	|j                   |                     ||j                   dS )
zD
        A non-empty title format adds the specified title.
        r   r   r   Nr   r   r   r   rX   r   r   z
20-01-2001r   a              Loading template...
            Finding news fragments...
            Rendering news fragments...
            Draft only -- nothing has been written.
            What is seen below is what would be written.

            [20-01-2001] CUSTOM RELEASE for FooBarBaz version 7.8.9
            =======================================================

            Features
            --------

            - Adds levitation (#123)
            - Extends levitation (#124)



        r   r   r   r    r   r   r!   r"   r#   r$   r&   r'   r(   expected_outputs        r)   test_title_format_customz TestCli.test_title_format_custom  sh    1377 	'1GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 5s;; 	*qGG()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*   
 
 !
 
, 	F,---&-88888rl   z
        [tool.towncrier]
        package = "foo"
        filename = "NEWS.md"
        title_format = "[{project_date}] CUSTOM RELEASE for {name} version {version}"
        c                 D   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t          g d          }t	          d          }|                     d|j                   |                     ||j                   dS )a  
        A non-empty title format adds the specified title, and if the target filename is
        markdown then the title is added as given by the config.
        In this way, full control is given to the user.
        We make this choice for markdown files
        because markdown header levels depend on where in the file
        the section is being written and require modifications in the same line,
        hence there is no easy way to know what to do to get the header to be at the right level.
        This avoids a repeat of the regression introduced in
        [#610](https://github.com/twisted/towncrier/pull/610),
        which mistakenly assumed that starting the line with '# ' would work in all use cases.
        r   r   r   Nr   ak              Loading template...
            Finding news fragments...
            Rendering news fragments...
            Draft only -- nothing has been written.
            What is seen below is what would be written.

            [20-01-2001] CUSTOM RELEASE for FooBarBaz version 7.8.9

            ### Features

            - Adds levitation (#123)



        r   r   r   s        r)   !test_title_format_custom_markdownz)TestCli.test_title_format_custom_markdown  s    * 1377 	'1GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'  
 
 !
 
& 	F,---&-88888   377z
        [tool.towncrier]
        package = "foo"
        filename = "NEWS.md"
        title_format = "### [{project_date}] CUSTOM RELEASE for {name} version {version}"
        template = "custom_template.md"
        c                    t          dd           t          ddd           t          d          }t          d|                    d	d
                     |                    t          ddgd          }t          dd          5 }|                     d           ddd           n# 1 swxY w Y   |                     d|j        |j                   t          d          }t          d          }|                     ||           dS )at  
        Test that we can inject markdown after some fixed header
        and have the injected markdown header levels set at the desired level.
        This avoids a repeat of the regression introduced in
        [#610](https://github.com/twisted/towncrier/pull/610),
        which mistakenly assumed that starting the line with '# ' would work in all use cases.
        r   r   NEWS.mda  
                # Top title

                ## Section title

                Some text explaining something

                another line

                ## Release notes

                <!-- towncrier release notes start -->

                a footer!
            Tcontentsr   ztemplates/default.mdzcustom_template.mdz### {{ definitionsz#### {{ definitions)r   r   r   Frs   r   Nr   aw  
            # Top title

            ## Section title

            Some text explaining something

            another line

            ## Release notes

            <!-- towncrier release notes start -->

            ### [01-01-2001] CUSTOM RELEASE for Foo version 1.2.3

            #### Features

            - Adds levitation (#123)


            a footer!
            )r   r   replacer    r   r   r!   r"   r#   r   r   )r$   r&   default_templater(   r'   r#   r   s          r)   #test_markdown_injected_after_headerz+TestCli.test_markdown_injected_after_headerL  so   " 	-/@AAA #	
 	
 	
 	
( --CDD %--$&; 	
 	
 	
 	
 ux&>QVWW1377 	'1GG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	F,fm<<<i 
 
2 	&11111s   B((B,/B,zy
        [tool.towncrier]
        package = "foo"
        title_format = false
        template = "template.rst"
        c                 b   t          dd          5 }|                    t          d                     ddd           n# 1 swxY w Y   |                    t          g dd          }t          d          }|                     d	|j                   |                     ||j                   dS )
z
        Setting the title format to false disables the explicit title.  This
        would be used, for example, when the template creates the title itself.
        template.rstr   a                  Here's a hardcoded title added by the template
                ==============================================
                {% for section in sections %}
                {% set underline = "-" %}
                {% for category, val in definitions.items() if category in sections[section] %}

                {% for text, values in sections[section][category]|dictsort(by='value') %}
                - {{ text }}

                {% endfor %}
                {% endfor %}
                {% endfor %}
            Nr   Frs   a[              Loading template...
            Finding news fragments...
            Rendering news fragments...
            Draft only -- nothing has been written.
            What is seen below is what would be written.

            Here's a hardcoded title added by the template
            ==============================================

        r   )r   r   r   r    r   r!   r"   r#   r   s        r)   test_title_format_falsezTestCli.test_title_format_false  s    .#&& 	!GG   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	(    #  
 
 !

 
 	F,---&-88888s   #A  AAzT
        [tool.towncrier]
        start_string="Release notes start marker"
        c                    t          j        d           t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t
          g d          }|                     d	|j        |j                   | 	                    t           j
                            d          t          j        d
                     t          d          }t          d          }|                     ||           dS )z
        The `start_string` configuration is used to detect the starting point
        for inserting the generated release notes. A newline is automatically
        added to the configured value.
        r   r   r   r   Nr4   z6a line

another

Release notes start marker
a footer!
r   r   r3   a              a line

            another

            Release notes start marker
            foo 7.8.9 (01-01-2001)
            ======================

            Features
            --------

            - Adds levitation (#123)


            a footer!
        )r@   rY   r   r   r    r   r!   r"   r#   rF   r   r;   r   r   r   )r$   r&   r'   r(   r#   r   s         r)   test_start_stringzTestCli.test_start_string  s    	!!!-s33 	'qGG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'*c"" 	TaGGRSSS	T 	T 	T 	T 	T 	T 	T 	T 	T 	T 	T 	T 	T 	T 	T   
 
 	F,fm<<<z22BJsOODDDj!! 
 
( 	&11111s#   AAA"BBBc                 2   t          dd           t          ddd           |                    t          ddgd	
          }|                     d|j        |j                   t          d          }t          d          }|                     ||           dS )zS
        The default start string is ``.. towncrier release notes start``.
        r   r   r4   z
                a line

                another

                .. towncrier release notes start

                a footer!
            Tr   r   r   Frs   r   a  
            a line

            another

            .. towncrier release notes start

            Foo 1.2.3 (01-01-2001)
            ======================

            Features
            --------

            - Adds levitation (#123)


            a footer!
            Nr   r    r   r!   r"   r#   r   r   r$   r&   r(   r#   r   s        r)   test_default_start_stringz!TestCli.test_default_start_string  s    
 	-/@AAA 	
 	
 	
 	
 ux&>QVWWF,fm<<<j!! 
 
* 	&11111r/   zW
        [tool.towncrier]
        package = "foo"
        filename = "NEWS.md"
        c                 2   t          dd           t          ddd           |                    t          ddgd	
          }|                     d|j        |j                   t          d          }t          d          }|                     ||           dS )zn
        The default start string is ``<!-- towncrier release notes start -->`` for
        Markdown.
        r   r   r   z
                a line

                another

                <!-- towncrier release notes start -->

                a footer!
            Tr   r   r   Frs   r   z
            a line

            another

            <!-- towncrier release notes start -->

            # Foo 1.2.3 (01-01-2001)

            ### Features

            - Adds levitation (#123)


            a footer!
            Nr   r   s        r)   "test_default_start_string_markdownz*TestCli.test_default_start_string_markdownE  s     	-/@AAA 	
 	
 	
 	
 ux&>QVWWF,fm<<<i 
 
& 	&11111r/   z
        [tool.towncrier]
        name = ""
        directory = "changes"
        filename = "NEWS.md"
        version = "1.2.3"
        c                 2   t          dd           t          ddd           |                    t          ddgd	
          }|                     d|j        |j                   t          d          }t          d          }|                     ||           dS )z
        When configured with an empty `name` option,
        the default template used for Markdown
        renders the title of the release note with just
        the version number and release date.
        zchanges/123.featurer   r   z\
                A line

                <!-- towncrier release notes start -->
            Tr   r   r   Frs   r   z
            A line

            <!-- towncrier release notes start -->

            # 1.2.3 (01-01-2001)

            ### Features

            - Adds levitation (#123)
            Nr   r   s        r)   test_markdown_no_name_titlez#TestCli.test_markdown_no_name_titley  s      	#%6777
 	
 	
 	
 	
 ux&>QVWWF,fm<<<i 

 
 	&11111r/   z
        [tool.towncrier]
        title_format = "{version} - {project_date}"
        template = "template.rst"

          [[tool.towncrier.type]]
          directory = "feature"
          name = ""
          showcontent = true
        c                    t          j        d           t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    t	          d                     ddd           n# 1 swxY w Y   |                    t          g d          }t	          d	          }|                     d
|j        |j	                   |                     ||j	                   dS )zP
        Spacing is proper when drafting with a topline and a template.
        r   r   r   r   Nr   a                  {% for section in sections %}
                {% set underline = "-" %}
                {% for category, val in definitions.items() if category in sections[section] %}

                {% for text, values in sections[section][category]|dictsort(by='value') %}
                - {{ text }}

                {% endfor %}
                {% endfor %}
                {% endfor %}
            )--version=7.8.9z
--name=foo--date=20-01-2001r   aC              Loading template...
            Finding news fragments...
            Rendering news fragments...
            Draft only -- nothing has been written.
            What is seen below is what would be written.

            7.8.9 - 20-01-2001
            ==================

            - Adds levitation


        r   )
r@   rY   r   r   r   r    r   r!   r"   r#   r   s        r)   (test_with_topline_and_template_and_draftz0TestCli.test_with_topline_and_template_and_draft  s     	!!!-s33 	'qGG%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'.#&& 	!GG   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	$   
 
 !
 
" 	F,fm<<<&-88888s#   AAA"#BBBz"
        [tool.towncrier]
        c                    t          j        d           t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d	           ddd           n# 1 swxY w Y   t          d
d          5 }|                    d           ddd           n# 1 swxY w Y   |                    t
          g d          }t          d          }|                     d|j        |j	                   |                     ||j	                   dS )
        When ``showcontent`` is false (like in the ``misc`` category by default),
        orphans are still rendered because they don't have an issue number to display.
        r   newsfragments/123.miscr   MiscNnewsfragments/345.miscAnother miscnewsfragments/+.miscOrphan misc still displayed!newsfragments/+2.misc$Another orphan misc still displayed!r   r   r   a              Loading template...
            Finding news fragments...
            Rendering news fragments...
            Draft only -- nothing has been written.
            What is seen below is what would be written.

            7.8.9 (20-01-2001)
            ==================

            Misc
            ----

            - #123, #345
            - Another orphan misc still displayed!
            - Orphan misc still displayed!



        r   
r@   rY   r   r   r    r   r   r!   r"   r#   r   s        r)   test_orphans_in_non_showcontentz'TestCli.test_orphans_in_non_showcontent  sa    	!!!*C00 	AGGFOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	*C00 	$AGGN###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$(#.. 	4!GG2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4)3// 	<1GG:;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<   
 
 !
 
. 	F,fm<<<&-88888r   zB
        [tool.towncrier]
        filename = "CHANGES.md"
        c                    t          j        d           t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d	           ddd           n# 1 swxY w Y   t          d
d          5 }|                    d           ddd           n# 1 swxY w Y   |                    t
          g d          }t          d          }|                     d|j        |j	                   |                     ||j	                   dS )r   r   r   r   r   Nr   r   r   r   r   r   r   a              Loading template...
            Finding news fragments...
            Rendering news fragments...
            Draft only -- nothing has been written.
            What is seen below is what would be written.

            # 7.8.9 (20-01-2001)

            ### Misc

            - #123, #345
            - Another orphan misc still displayed!
            - Orphan misc still displayed!



        r   r   r   s        r)   (test_orphans_in_non_showcontent_markdownz0TestCli.test_orphans_in_non_showcontent_markdown"  sa    	!!!*C00 	AGGFOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	*C00 	$AGGN###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$(#.. 	4!GG2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4)3// 	<1GG:;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<   
 
 !
 
* 	F,fm<<<&-88888r   c                 t   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y    |             t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          d	d          5 }|                    d
           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          g d           |                    t          g d          }|                     d|j                   dD ]8}|                     t          j	        
                    d| d                     9d}|                     t          j	        
                    |                     t          |                                          }|                     |t          d                     dS )z
        At build time, it will delete any fragment file regardless of its stage,
        included files that are not part of the git reporsitory,
        or are just staged or modified.
        r   r   z Adds levitation. File committed.Nzfoo/newsfragments/124.featurez)Extends levitation. File modified in Git.foo/newsfragments/125.featurezBaz levitation. Staged file.zfoo/newsfragments/126.featurez)Fix (literal) crash. File unknown to Git.az Extended for an hour.)gitaddr   r   r   )123124125126zfoo/newsfragments/z.featurer4   a                  Foo 1.2.3 (01-01-2001)
                ======================

                Features
                --------

                - Adds levitation. File committed. (#123)
                - Extends levitation. File modified in Git. Extended for an hour. (#124)
                - Baz levitation. Staged file. (#125)
                - Fix (literal) crash. File unknown to Git. (#126)
                )r   r   r   r    r   r!   r"   r:   r@   r   r   rF   r   r   )r$   r&   r   r'   r(   r   r   news_contentss           r)   test_uncommitted_fileszTestCli.test_uncommitted_filesX  s|    1377 	81GG6777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	81377 	A1GG?@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	1377 	41GG2333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	41377 	A1GG?@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 1377 	.1GG,---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.<<<===u&G&G&GHHF,---4 	V 	VHRW^^,S,S,S,STTUUUUt,,---T

)) 	
 	
 	
 	
 	
sT   377A00A47A4B77B;>B;C44C8;C8D11D58D5z
        [tool.towncrier]
        package = "foo"
        ignore = ["template.jinja", "CAPYBARAS.md", "seq_wildcard_[ab]"]
        c                    t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          d	d          5 }|                    d
           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t          dg          }|                     d|j        |j                   dS )z
        When `ignore` is set in config, files with those names are ignored.
        Configuration supports wildcard matching with `fnmatch`.
        r   r   &This has valid filename (control case)Nz foo/newsfragments/template.jinjaz'This template has been manually ignoredzfoo/newsfragments/CAPYBARAS.mdz,This markdown file has been manually ignoredzfoo/newsfragments/.gitignorez"gitignore is automatically ignoredz foo/newsfragments/seq_wildcard_az!Manually ignored with [] wildcardr   r   r   r   r    r   r!   r"   r#   rj   s       r)   test_ignored_fileszTestCli.test_ignored_files  s    1377 	>1GG<===	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>4c:: 	?aGG=>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?2C88 	DAGGBCCC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D0#66 	:!GG8999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:4c:: 	9aGG7888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 uyk22F,fm<<<<<sT   377A00A47A4B--B14B1C**C.1C.D''D+.D+zN
        [tool.towncrier]
        package = "foo"
        ignore = []
        c                    t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t          dg          }|                     d|j        |j                   |                     d	|j                   dS )
zR
        When `ignore` is set in config, invalid filenames cause failure.
        r   r   r
  Nfoo/newsfragments/feature.1243This has the issue and category the wrong way roundr   r   z'Invalid news fragment name: feature.124r   r   r    r   r!   r"   r#   r^   rj   s       r)   test_invalid_fragment_namez"TestCli.test_invalid_fragment_name  sQ    1377 	>1GG<===	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>1377 	K1GGIJJJ	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K uyk22F,fm<<<?OOOOOrl   z
        [tool.towncrier]
        package = "foo"
        template = "foo/newsfragments/template.j2"
        ignore = ["placeholder-to-trigger-strict-checks.txt"]
        c                    t          dd          5 }|                    d           ddd           n# 1 swxY w Y   t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t          dg          }|                     d|j        |j                   |                     d	|j                   dS )
z
        The `template` filename is automatically ignored when it
        is stored in the same path as the newsfragment files.
        r   r   zBrand new thing.Nzfoo/newsfragments/template.j2a  
{% for section, _ in sections.items() %}
{% for category, val in definitions.items() if category in sections[section]%}
{{ definitions[category]['name'] }}

{% for text, values in sections[section][category].items() %}
- TEST {{ text }}
{% endfor %}

{% endfor %}
{% endfor %}
r   r   z- TEST Brand new thing.
r  rj   s       r)   test_ignore_template_filenamez%TestCli.test_ignore_template_filename  sI    1377 	(1GG&'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(1377 	1GG  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	" uyk22F,fm<<<16=AAAAArl   c                     t          dd          5 }|                    d           ddd           n# 1 swxY w Y   |                    t          g d          }|                     d|j        |j                   dS )z
        When `ignore` is not set in config, invalid filenames are skipped.

        This maintains backward compatibility with before we added `ignore`
        to the configuration spec.
        r  r   r  N)r   r   r   rX   z1.0.0r   r  rj   s       r)   test_no_ignore_configuredz!TestCli.test_no_ignore_configured  s     1377 	K1GGIJJJ	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K LLL
 
 	F,fm<<<<<r   )2__name__
__module____qualname__maxDiffr   r*   r.   r1   rJ   rN   rS   rZ   r_   rb   re   rk   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r   r/   r)   r   r      s(       G\^^D
 D
 ^D
L     " " " \^^= = ^=. \^^= = ^= \^^= = ^=< \  7 7 7. \^^	B 	B ^	B \^^B B ^B \^^
9 
9 ^
9 \^^O O ^OX
 X
 X
t I I I& 9 9 9$ 8 8 80 . . .0 8 8 80
R 
R 
R \+,,,G G G G -,G \^^4
 4
 ^4
l \  #
 #
 #
J \  %
 %
 %
N \+,,,(
 (
 -,(
T \  I
 I
 I
V \  
 
 
S S Sj \  G
 G
 G
R \  .9 .9 .9` \  09 09 09d \  F2 F2 F2P \  69 69 69p \  12 12 12f \^^,2 ,2 ^,2\ \  +2 +2 +2Z \  $2 $2 $2L \	  59 59 59n \  
09 09 
09d \  .9 .9 .9` 1
 1
 1
f \  = = =& \  P P P \  B B B8 \^^= = ^= = =r/   r   )r@   r<   datetimer   pathlibr   
subprocessr   textwrapr   unittest.mockr   click.testingr   twisted.trial.unittestr	   _shellr   buildr   helpersr   r   r   r   r   r   r  r/   r)   <module>r%     s#   
			                                # # # # # # + + + + + +             S S S S S S S S S S S S S SW= W= W= W= W=h W= W= W= W= W=r/   